Fastai2's ImageClassifierCleaner to clean image data is not showing up in Colab

Hi friends,

I am trying to follow the new fastbook using colab notebook. When I’am trying to clean the data(images) after applying cnn_learner, the images are not showing up. Please find the image below. Does anyone already facing the same issue? How can it be resolved? @sgugger @muellerzr can you please look after this issue.?

1 Like

Yes, presume all widgets are broken in Colab and need special attention. I personally don’t have time ATM to investigate though. If you wish to use any widget functionality, I’d recommend Paperspace

1 Like

Oh fine. Thanks for pointing out. Can you please point me, the way I can contribute which renders the widget functionality in colab? I will try to workout in Paperspace for now.

It’ll require a rewrite of a number of the ipywidget function calls and it’s not compatible with base Jupyter, so if you do get it, know you won’t be able to submit a PR (if you had this in mind, also because it’s Google).

However, this notebook is colabs example for widgets:

https://colab.research.google.com/notebooks/widgets.ipynb

And I’d recommend looking at and comparing two implementations of the same widget I built. The first (in fastai) was built on Jupyter, the second in Colab

Jupter Colab

Okay fine. I think this is something that I might not handle…

I’m having same issue in Paperspace. I get…

NameError: name ‘ImageClassifierCleaner’ is not defined.

I couldn’t find online anywhere hoe to define it.

It’s defined under Vision widgets, but really no information on how to use it, or its parent class ImagesCleaner. It does run for me, though, on Paperspace. If you are using v2, make sure you have run from fastai2.vision.widgets import * before trying to use it. Should also make sure to run from utils import *.

6 Likes

@vinceg Thank you, this fixed the problem

1 Like

@vinceg Thanks, your info was helpful! It could be applied to cases where v2 is not used, but the same widget problem occurs in the collab, I just run fastai.vision.widgets import * then it works without from utils import *.

Yes, this works in Colab:

from fastai.vision.widgets import *
cleaner=ImageClassifierCleaner(learn)