Bear detector question on confusion matrix

I have a question on the part 2 tutorial on the bear detector. I followed the steps pretty much step by step but substituted duck duck go for the bing search utility to get my bears. When I get to the plot_confustion_matrix step, I expected to get numbers bigger than what I get in the matrix. Despite having downloaded about 90 bear images, I get numbers in the matrix that don’t add up to anywhere close to 90. What I get is 4, 5, and 6 in the diagonal (correct identifications) for black, grizzly and teddy bears respectively. Any idea on what is going on here?

Byron Douglas (ML newbie)

  • This should be posted in the Part 1 2022 topic.
  • I need more information on your code to be more helpful. It will be best if you can share the notebook or paste the code here.

From what I know, plotting confusion matrices sometimes show erratic data when used on kaggle, I don’t know which platform you’re using, but at least try switch to google colab or your local environemnt and try again.

Thanks Jumpy Jason, I was thinking chapters vs. parts (re. Part 1 2022 Topic). I am using Kaggle, but I will try in Google Colab first before reposting.
Thanks!

Hello @tbyrondouglas,
It sounds like your dataset wasn’t properly labeled or loaded—DuckDuckGo may have returned fewer usable or correctly classified images than expected. Double-check your image folder structure and ensure each class is correctly mapped. Also verify your validation set size; the confusion matrix only reflects predictions on that subset, not the full 90 images.

Best Regards,
Kyla Ellis

Thanks Kyla, your last point was exactly my issues. The confusion matrix wasn’t showing the full 90, only a subset. Thanks!