Hello Everyone,
I trained the model on GPU and saved the model. But, I want to load this model and make the predictions on CPU. Unfortunately, the CPU usage is too high as you can see below.
img = Image.open(filePath)
tfms = transforms.Compose([
transforms.Resize((config["Img_Height_Pred"], config["Img_Width_Pred"])),
transforms.ToTensor(),
transforms.Normalize([0.0], [1.0])])
model.eval()
img_tensor = tfms(img).unsqueeze(0)
with torch.no_grad():
preds = torch.sigmoid(model(img_tensor))
preds = (preds > 0.5).float()
tensor_to_pil = transforms.ToPILImage()(preds.squeeze_(0))
Is there anything I can do to lower the CPU usage?
Best,
Thalia