Confusion matrix problem

Hello All!
I am trying to reproduce Lesson 2 code (bears) on my MacBook Pro with M2 processor. Everything works except that the confusion matrix shows wrong number of images. I have 79 images in the image download but the confusion matrix has very small total number of entries - only 15! Here is what the numbers are:

interp.confusion_matrix()

array([[3, 1, 0],
[0, 5, 0],
[0, 0, 6]])

I played with Lesson 1 as well (with birds and forests), manually changed number of images in the input folders but invariably get MUCH smaller total of the confusion matrix entries than total images.

I wonder if anyone saw this and knows the fix…

Appreciate a lot in advance!!!

3 Likes

Could it be that your validation dataset has only 15 images (20% of 79 images, rounded down to the nearest integer), and that’s the confusion matrix you are looking at? Fastai makes you always have a validation dataset to avoid embarrassing overfitting situations.

1 Like

Hi Gautam,
thank you for your insight - this must be exactly it. I rerun with 150 images and get 30 in the confusion matrix. I did not appreciate that it only reports on validation set!

Thank you again!

1 Like