Lesson2: How to see misclassified images quickly

In my Cricket Ball vs Tennis Ball, I find that only three images are consistently creating an issue.


  1. Assuming this is from the Validation set (not training set!)
  2. How do I quickly see these three “confusing” images and either re-classify or delete them? (I am on Google Collab so possibly UI utilities not work but will let experts guide me if they will)

Please see my ClassConfusion widget, it works for Colab too :slight_smile: I built it just for this! (And for colab)


you are a hero! going to try that right now and get back to you :slight_smile:

1 Like

Perfect :slight_smile: let me know if there’s any issues. There’s also documentation on the docs.fast.ai page


Looks like I need to find where to install ClassLosses (looked at your github and also on fastai docs but could not find it)
Am I missing something basic (that’s totally possible :smile:)

Ah! Sorry try ClassConfusion :slight_smile: I need to update that tutorial :sweat_smile:

Also cd into the cloned git repository if you haven’t already

This is where I stand.

I guess I don’t understand the last line (and how to do that on Collab)… my worry is that if I “cd” into some other directory I will lose context of the path… won’t I?

BTW happy to help if you are updating the document… you won’t find a better guy to make it fool-proof!

So we have two different versions. One specifically for Colab (when you git clone) and one for other jupyter environments (from fastai.widgets)

So you’ll want to git clone that repository and then you can do from ClassConfusion import * (you may not need to cd into ClassConfusion, try both and if it’s not solved by when I have a computer I’ll look at it :slight_smile: )

I have a plus and a minus!
I learnt how to clone github into google collab (basically the code is copied into my working directory)

So thanks for that!

But then ran out of luck and got an error trying to run the ClassConfusion

also tried running the code from ClassConfusion fast.ai documentation
ClassConfusion(interp, classlist, is_ordered=False, figsize=(8,8))
but same error (NoneType!)

1 Like

Interesting. I bet it’s a bug with the regex it looks like. Give me a little to run it myself and I’ll see if I can fix it

Ah I think I know the issue. Try this for me @yogendrajoshi, copy everything from the classConfusion.py into a cell and comment out the fn = re.search() line. Then try again. That regex is specifically for the PETs notebook and dataset and I bet that’s what’s going wrong. Tell me what that outputs for the title of the images.

What that regex should do is select everything up to the last bit of the filename.

EG for pets:

Without regex:

With regex:

Can you give me an example of a filename that it prints for the title?

Will try that first thing in the morning. (I am in India)

1 Like

All good! I appreciate you pointing this out and I’ll try on my own dataset (if I have time before then). Thanks @yogendrajoshi :slight_smile:

Yuppi… it works! Now I guess I can remove these images and try again.
Thanks a bunch.

Do let me know if you are able to update the git so that next time I will just be lazy :slight_smile:

1 Like

Hi, is it possible to use this widget for multi label classification problems as well. I ran into some bugs and can’t find any documentations on it.

1 Like