Hi, I am new to fastai and just wanna test out “mixup” callback as mentioned on chapter 7 of the fastbook.

`model_arch = resnet18 learn = cnn_learner(dls, model_arch, loss_func= CrossEntropyLossFlat(), cbs=MixUp(), metrics = accuracy, model_dir = model_path)`

When I tried to call “plot_confusion_matrix()” method, it return the below message. I also noticed that I got a prediction score range not between 0 and 1 (from 1.2 to 5 approximately) for some of my images. Is this a bug from fastai?

AssertionError Traceback (most recent call last)

in

1 interp = ClassificationInterpretation.from_learner(learn)

----> 2 interp.plot_confusion_matrix()~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/fastai/interpret.py in plot_confusion_matrix(self, normalize, title, cmap, norm_dec, plot_txt, **kwargs)

68 “Plot the confusion matrix, with`title`

and using`cmap`

.”

69 # This function is mainly copied from the sklearn docs

—> 70 cm = self.confusion_matrix()

71 if normalize: cm = cm.astype(‘float’) / cm.sum(axis=1)[:, np.newaxis]

72 fig = plt.figure(**kwargs)~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/fastai/interpret.py in confusion_matrix(self)

60 “Confusion matrix as an`np.ndarray`

.”

61 x = torch.arange(0, len(self.vocab))

—> 62 d,t = flatten_check(self.decoded, self.targs)

63 cm = ((d==x[:,None]) & (t==x[:,None,None])).long().sum(2)

64 return to_np(cm)~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/fastai/torch_core.py in flatten_check(inp, targ)

751 “Check that`out`

and`targ`

have the same number of elements and flatten them.”

752 inp,targ = inp.contiguous().view(-1),targ.contiguous().view(-1)

–> 753 test_eq(len(inp), len(targ))

754 return inp,targ~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/fastcore/test.py in test_eq(a, b)

32 def test_eq(a,b):

33 "`test`

that`a==b`

"

—> 34 test(a,b,equals, ‘==’)

35

36 # Cell~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/fastcore/test.py in test(a, b, cmp, cname)

22 "`assert`

that`cmp(a,b)`

; display inputs and`cname or cmp.__name__`

if it fails"

23 if cname is None: cname=cmp.name

—> 24 assert cmp(a,b),f"{cname}:\n{a}\n{b}"

25

26 # CellAssertionError: ==:

63000

63