Lesson 2 official topic

It entirely depends on what sort of images you want yours model to work on.

If you want to detect the shape of a plane, then you may want to remove interior images. If you only want to detect real life planes, then you may want to remove pictures of planes, such as on the shirt.


Hi, I’m having some trouble importing my pickle file to make the web app.
I’m getting the following error message and can’t work out where the issue might be coming from.

search_images_ddg() returns urls directly. you do not need to send attrgot()

General strategy to work out where an issue comes from…

  1. Duplicate the code which generates and saves your pickle file,
    then append the “load_learner()” line. Presumably the “load_learner()” line works successfully.
  2. Starting just above the “load_learner()” and working up, progressively delete small parts of the code and run it, until you recreate the “load_learner()” issue. Once you are able to iterate around a point breaking/fixing the code, you have your best chance to understand the issue.
1 Like

Thanks - I realised that I had forgotten to define the label function again before loading the learner.

1 Like

I used my model from lesson 1, which classifies chess pieces and created a deployment on Hugging-Faces: Chess Classifier - a Hugging Face Space by mw00 (unfortunately for some reason the example images don’t work, but uploading your own works fine)

I also updated the notebook with a confusion matrix and as it turns out, the model has problems distinguishing Kings and Queens! Is it a King? | Kaggle

Some weird problem I encountered after deploying to huggingfaces spaces, just in case anyone else encounters it. It says

Your space is on error, check its status on hf.co

But a hard refresh on the browser fixed it. Did that after reading this: Error when i switch the Space to public - Spaces - Hugging Face Forums

Is there a macOS version of the python environment installation guide?

You need to define the get_label function again in your notebook/script.

Possibly this thread will help.

In order to deploy my bear classifier as a real application in Binder, I have encountered some compatibility issues between the different dependencies. I’m posting this in case I can save some hours of work for a beginner like me.

First I prepared a notebook based on GitHub - fastai/bear_voila: Demo bear classifier with fastai and Voila. The notebook ran correctly in Colab and Gradio, but when I ran the notebook on my computer, both in voila and Jupyter (notebook and lab), I always got the same error:
Failed to load model class ‘VBoxModel’ from module ‘@jupyter-widgets/controls’

When I installed fastbook on my computer, it also installed ipywidgets 7.7.2. I tried different versions of ipywidgets (7.5.1, 7.6.5 ), but the error persisted. In the end I decided to install the latest version of ipywidgets 8.0.4 (although it is not fastbook compatible). Now the error was different:

Then I had to modify the code, so I have one version for Colab and Gradio and another one for my computer and Binter:

Mi equipo es Linux Mint 21.1 y algunas de las dependencias que tengo instaladas son:

On another note, in all the notebooks of lessons 1 and 2 there is a warning that I have not been able to solve:

Can someone help me? Thank you very much.


I tried to create a person using hardhat detector and… it simple doesnt work haha

The responses seems to be super random,
I tried to get those datasets:
search_terms = ‘people using hardhat photos’,‘people using hat photos’, ‘people’

cause I wanted to detect a person using hardhat, not only the hardhat

Here is my notebook, if someone can give me some feedback and point to me how can I make this better, i would be super glad =)

I managed to create the app on hugging face with Gradio though, which was super cool, hopefully I can make this model work properly and I can show case somewhere

Hello :slight_smile:

As suggested in the book, I wrote a small blog post detailing the issues I had when deploying my image classifier on HuggingFace spaces with Gradio.

I hope you will find it useful :slight_smile:

1 Like

Might want to try “people wearing hardhat” instead. “people wearing hat”

Entirely stuck once the command line and VScode got pulled into the mix. The lesson could be cleaned up a bit so it doesn’t jump around so much. Probably shouldn’t expect folks to learn all of that whilst also learning this or at least have direct resources so we could get going and straight to what is needed. Should have a straight forward version of building and downloading the files to upload to hugging face and then another version of how to do it in full through the terminal + VScode.

I know I’m missing out on this and it’ll probably take me a few weeks to just get through this lesson because I’m so unfamiliar with these other tools.

Hello everyone. The Oxford-IIIT Pet Dataset only have 37 breeds. What can be done to predict a breed that is not part of the dataset, such as a Schnauzer?

you need to add images of the breed you are interested in to the dataset (using search_images_ddg for example) and train your model again, watching the lesson 2 video will be useful: Lesson 2: Practical Deep Learning for Coders 2022 - YouTube

1 Like

Hi, thanks

I already saw the class but as I understand it, it would only serve me to classify that specific breed. Is there a way to add new breeds to the PETS dataset or train the PETS-trained model with more breeds?

1 Like

You Should checkout The contents of The breeds dataset and add your breed with Images in the same style as the others. Which probably is a folder with images of the breed. Where the folder has the breed name. you could do this in the same way as you’ve done in the first two lessons, but now you add the categories to the breeds dataset


as @gmjn said, when you download your PETS dataset, create a new folder in it for your specific breed and fill it with images of the said breed, then modify your code to handle that additional breed and you are good to go!

1 Like