ImageClassifierCleaner not working

I am using the “advanced” method of Google Collab with Ngrok and native Jupyter notebooks. Widgets are supposed to work. When I run ImageClassifierCleaner, I get images but no widget:

Oddly, when I did this in regular Google Collab, the widget worked, even though it’s not “supposed” to.

I’ve tried pip install as per the Jupyter widget docs, but it didn’t work:

Any solutions? Have people gotten the widgets to work on Jupyter notebooks and collab?

Its not working for me in Google Colab.
What code did you use?

I know that this makes no sense, but it seems to work intermittently on Colab. I tried it again and it did not work, but I tried it just now and it is working. Here’s the proof:

To actually use the cleaner and modify the files, I found that I had to run the subsequent block of code (the cell that is commented out) for each subcategory. That is, run the code after selecting the options for brown bear training, again for brown bear validation, again for black bear training, etc. It would not “remember” what I’d chosen once I’d changed the set that I was working on.

I can’t tell you why it works sometimes and why it doesn’t. Furthermore, I cannot get it to work in native Jupyter notebooks using Ngrok, which is where it’s supposed to work. So YMMV.

i did what you said and tried started the
cleaner widget again after doing the unlink functions but the widget was giving me a file not found error, any suggestions?

Sorry, but no. I never got that error, and I don’t understand why it only sometimes works.

My only suggestion is to try it on a different virtual machine with Jupyter notebooks rather than using Colab.

I have also surprisingly managed to run the cleaner widget on Google Colab. It has worked every time I tried it though. It doesn’t remember choices, so I have to run the cleaning for every set of choices (bear type plus test or validation set). Since I have never ran the widget on real Jupyter, I actually thought that was the expected behavior.

Hello,
I also encounter some problems to understand the functioning of ImageClassifierCleaner (using Paperspace).

-I have executed

#hide_output
cleaner = ImageClassifierCleaner(learn)
cleaner

and got the expected result.
-Then I selected “delete” for a given picture
-Then I have executed :

for idx in cleaner.delete(): cleaner.fns[idx].unlink()

in order to drop the picture

The problem came after those steps. I tried to execute again :

cleaner = ImageClassifierCleaner(learn)
cleaner

I did this in order to see if my picture was deleted and to manage other pictures.
but I got the following error :

FileNotFoundError: [Errno 2] No such file or directory: ‘/notebooks/fastbook/bears/black/00000080.jpg’

I obviously miss something…
Could you explain what I did wrong?

Thanks in advance for your help !

3 Likes

Hey! Not sure if you ever figured this out, but I’m having the same issue. I bypassed the error by using

try:
clear = …
except:
pass

I have the same problem using kaggle. I get the images loading without the widget. I tried your approach too but it didn’t help.

I figured out where the problem was with Kaggle. It’s somehow related to their working directory that they assign to you. When I ran my notebook for the first time it worked and showed the widget . but when I tried to run it for the second time I face this issue and the widget was not loading. I fixed the issue by changing the directory name where all downloaded images were being stored and the problem is solved.

To what did you change the directory name? I still get the same error in Kaggle.