Hi all
Here’s my situation:

Test image (no label) that I want to classify based on a fine-tuned model trained on a similar dataset as the test image.
test_img = test_img.resize(torch.Size([test_img.shape[0],224, 224]))
test_img.data.shape
torch.Size([3, 224, 224])

Load an inference learner
learned_model = load_learner(path, ‘export_models/new_model_weights.pkl’)
Predict classification (CORRECT!)
learned_model.predict(test_img)
(Category class 3,
tensor(3),
tensor([0.0157, 0.0804, 0.0055, 0.8985]))
To see the corresponding heat map:
interp = ClassificationInterpretation.GradCAM(learned_model, test_img)


`AttributeError Traceback (most recent call last)
in
----> 1 interp = ClassificationInterpretation.GradCAM(learn_se_rn50, test[0])
/exp/home/rdass/Research/tensorflowEnv/lib64/python3.6/site-packages/fastai/vision/learner.py in _cl_int_gradcam(self, idx, ds_type, heatmap_thresh, image)
137
138 def _cl_int_gradcam(self, idx, ds_type:DatasetType=DatasetType.Valid, heatmap_thresh:int=16, image:bool=True):
–> 139 m = self.learn.model.eval()
140 im,cl = self.learn.data.dl(ds_type).dataset[idx]
141 cl = int(cl)
AttributeError: ‘Learner’ object has no attribute ‘learn’`