Closed LulaSan closed 3 years ago
It turned out that this
imgOrig = np.array(Image.open(img_path))
img = np.asfarray(imgOrig, dtype=np.float32) / 255
img = np.resize(img, (3, 224, 224))
img = np.expand_dims(img, axis=0)
img = torch.from_numpy(img.copy())
the resize function, was wrong. I instead did in that way : img= plt.imread(img_path) imgResh = cv2.resize(img, dsize=(224, 224)) img = np.transpose(imgResh, (2,0,1)) img = np.expand_dims(img, axis=0)
@LulaSan Can you share which model did you use?
@metobom I used mobilenet-nnconv5dw-skipadd-pruned.pth.tar', loading in this way
import models
import torch
#loading model trained
checkpointpath='mobilenet-nnconv5dw-skipadd-pruned.pth.tar'
if torch.cuda.is_available():
map_location=lambda storage, loc: storage.cuda()
else:
map_location='cpu'
checkpoint = torch.load(checkpointpath,map_location=map_location)
if type(checkpoint) is dict:
start_epoch = checkpoint['epoch']
best_result = checkpoint['best_result']
model = checkpoint['model']
print("=> loaded best model (epoch {})".format(checkpoint['epoch']))
Hi everyone, I am not currently using TVM for compatibility issues with colab, so I tried visualize the output without it. This is my code:
Is it normal?
P.S. I am using this as trained model
loading model trained
checkpointpath='mobilenet-nnconv5dw-skipadd-pruned.pth.tar'