Another potential bug:
When I create a DataBunch from a TensorDataset, as in lesson 5, and then try creating an ClassificationInterpretation
, it breaks.
interp = ClassificationInterpretation.from_learner(learn)
interp.plot_top_losses(9, figsize=(7,7))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-33-f4ec02bb4041> in <module>()
1 interp = ClassificationInterpretation.from_learner(learn)
----> 2 interp.plot_top_losses(9, figsize=(7,7))
~/Code/fastai/fastai/vision/learner.py in plot_top_losses(self, k, largest, figsize)
96 "Show images in `top_losses` along with their prediction, actual, loss, and probability of predicted class."
97 tl_val,tl_idx = self.top_losses(k,largest)
---> 98 classes = self.data.classes
99 rows = math.ceil(math.sqrt(k))
100 fig,axes = plt.subplots(rows,rows,figsize=figsize)
~/Code/fastai/fastai/basic_data.py in __getattr__(self, k)
99 return cls(*dls, path=path, device=device, tfms=tfms, collate_fn=collate_fn)
100
--> 101 def __getattr__(self,k:int)->Any: return getattr(self.train_dl, k)
102 def dl(self, ds_type:DatasetType=DatasetType.Valid)->DeviceDataLoader:
103 "Returns appropriate `Dataset` for validation, training, or test (`ds_type`)."
~/Code/fastai/fastai/basic_data.py in __getattr__(self, k)
22
23 def __len__(self)->int: return len(self.dl)
---> 24 def __getattr__(self,k:str)->Any: return getattr(self.dl, k)
25
26 @property
~/Code/fastai/fastai/basic_data.py in DataLoader___getattr__(dl, k)
6 __all__ = ['DataBunch', 'DeviceDataLoader', 'DatasetType']
7
----> 8 def DataLoader___getattr__(dl, k:str)->Any: return getattr(dl.dataset, k)
9 DataLoader.__getattr__ = DataLoader___getattr__
10
AttributeError: 'TensorDataset' object has no attribute 'classes'