Lesson 2 Errors: FileDeleter and ‘defaults” attribute

Hi All,

I started with Lesson 2 video yesterday. I created a model to classify the Indian street food, Pav Bhaji and Misal Pav, thought it would be interesting as both these dishes look very similar in photos.
I am using Google Colab, and got the error_rate to 0.265823.

I wanted to improve it further by cleaning up the data, However I couldn’t find the FileDeleter method as shown in the video, so I followed the tutorial from this GitHub link and used the ImageCleaner
ds, idxs = DatasetFormatter().from_toplosses(learn, ds_type=DatasetType.Valid)
ImageCleaner(ds, idxs, path)
but whenever I run the ImageCleaner, my Google colab instance gets disconnected and after reconnecting, the code cell becomes unresponsive as it keeps spinning.

Has anybody else faced the same problem?


I don’t think Colab is compatible with Jupyter widgets. Maybe clean your data locally by exporting the model and then retrain.

1 Like

Yes! I have tried multiple times to import the FileDeleter and it says it is ‘not defined’. I am using crestle, jupyter nbs and nothing I do seems to work.


Hey! Just finished the new Lesson 2 Video. So amazing how you can create a image classifier with google search and thus for any images.
Unfortunatly I stucked for hours on the same problem:
Im running my training on google colab and after exporting the .pkl file, i wanted to run the classifier on my windows pc. So i have all my files organized and ready but as soon as i hit “run” on my Jupyter Notebook, i get the following error message, wich didn’t appeared when i was runnning it on google colab:

NameError Traceback (most recent call last)
3 path = Path(‘data’)
4 img = open_image(path/‘bears’/‘grizzly’/‘00000006.jpg’)
----> 5 learn = load_learner(path)
6 pred_class,pred_idx,outputs = learn.predict(img)
7 pred_class

NameError: name ‘load_learner’ is not defined

My Code:
from fastai.vision import *
defaults.device = torch.device(‘cpu’)
path = Path(‘data’)
img = open_image(path/‘bears’/‘grizzly’/‘00000006.jpg’)
learn = load_learner(path)
pred_class,pred_idx,outputs = learn.predict(img)

Thanks to all of you answering and thanks to fast.ai for this amazing library!

1 Like

I’m using crestle/ jupyter nbs and adding print before pred_class worked for me.

pred_class,pred_idx,outputs = learn.predict(img)

1 Like

FileDeleter is not supported. Use ImageCleaner instead. The 2019 course notebook should already have this. The only problem with using imagecleaner is that it does not update the images. It creates a new csv file called cleaned.csv. This csv should be used to create a new Image Dataset.


Worked ok on Kaggle. The only problem I faced was that the delete button was not always visible. Also note that according to the documentation, you need to recreate the image dataset with cleaned.csv that is created by Imagecleaner


Thank youl I just gave up and was using ImageCleaner instead!

besides, does file deleter and image cleaner works in gradient/paperspace?
it doesn’t work on google colab only rite?

many thanks