Thanks for getting back to me, @ilovescience. I think I’m close to the solution, but still getting errors…
# Test image directory
test
ImageList (2 items)
Image (3, 299, 299),Image (3, 299, 299)
# Inference model
learned_model1 = load_learner(path, 'export_models/model1.pkl', test=test)
# get predictions
preds,y = learned_model1.get_preds(ds_type=DatasetType.Test)
preds
tensor([[7.0309e-01, 3.0540e-02, 2.6613e-01, 2.3129e-04],
[5.3039e-02, 5.6551e-01, 3.5939e-03, 3.7785e-01]])
# Load interpretation class - no errors (success, I think?)
interp = ClassificationInterpretation.from_learner(learned_model1, ds_type=DatasetType.Test, tta=True)
# Plot confusion matrix - works!
interp.plot_confusion_matrix()
# Plot gradcam image (as per your suggestion) - error :(
gradcam_image = interp.GradCAM(0,ds_type=DatasetType.Test)
TypeError Traceback (most recent call last)
in
----> 1 gradcam_image = interp.GradCAM(0, ds_type=DatasetType.Test, tta=True)
TypeError: _cl_int_gradcam() got an unexpected keyword argument ‘ds_type’
# Thought maybe the plot_top_loss() might work?
interp.plot_top_losses(2, heatmap=True)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in ----> 1 interp.plot_top_losses(2, figsize=(15,11), heatmap=True) /exp/home/rdass/Research/tensorflowEnv/lib64/python3.6/site-packages/fastai/vision/learner.py in _cl_int_plot_top_losses(self, k, largest, figsize, heatmap, heatmap_thresh, return_fig) 174 for i,idx in enumerate(tl_idx): 175 im,cl = self.data.dl(self.ds_type).dataset[idx] --> 176 cl = int(cl) 177 im.show(ax=axes.flat[i], title= 178 f’{classes[self.pred_class[idx]]}/{classes[cl]} / {self.losses[idx]:.2f} / {self.preds[idx][cl]:.2f}’) TypeError: int() argument must be a string, a bytes-like object or a number, not ‘EmptyLabel’