I'm using the pretrained resnet50 model and I have to use in this project this model with pretrained weights
original_model=torch.load('model_best.pth',map_location='cpu')
original_model.eval()
preproc_img = torch.FloatTensor(preproc_img)
out = original_model(preproc_img)
print("\nPyTorch model prediction: \n")
print("* shape: ", out.shape)
test_class_id = torch.argmax(out, axis=1).item()
print("* class ID: {}, label: {}".format(test_class_id, test_labels[test_class_id]))
confidence = out[0][test_class_id]
print("* confidence: {:.4f}".format(confidence.item()))
which gives:
AttributeError: 'collections.OrderedDict' object has no attribute 'eval'