Wrong identification on uploading

In Lesson 2, when I upload a tricky image such as a “teddy dog”, it is recognized as a teddy. What can I do to rectify this and train the model?

The model we built in Lesson 2 was a simple model, and we only showed it data on ‘teddy bear’, ‘black bear’ and ‘grizzly bear’.

This simply means the image you uploaded is more ‘teddy’ than ‘grizzly’ or ‘black’ bear.

Just a hypothesis here, try training it with the ‘Teddy Dog’ example included in the data, maybe it should be able to differentiate them after.

1 Like

I understand that we only had those three categories. I intentionally tried uploading something tricky to see how it works.
Thanks for your suggestion. I’ll look into it :blush:

1 Like

I’m still new at this, but my understanding is that if you want it to categorize something as not in those categories you need to provide a fourth option, something like not-bear. The more you train with images that are close to your three categories, the better the model will do at differentiating between correct answers (teddy bears) and wrong answers (teddy dogs or whatever).


Mutli-Label Classification would help with this.
It’s covered in Lesson 6 I guess

1 Like

Multi-label classification didn’t help when I tried it even though it is supposed to recognize things that aren’t from the model. I turned my bears notebook into a multi-category version and the teddy bear images that I got from the internet are so varied that the model seems to classify anything that doesn’t look like a grizzly or black bear as a teddy bear. I had to add a fourth category to get mine to work even in the multi-category system.

1 Like

you can’t do that since you’d have to provide it images of not-bear. what you want is for it to tell you that it thinks none of your classes are present, and you probably need to do this by not using softmax at the end.

i know @muellerzr has an example notebook somewhere for fastai 2 which does this but I can’t find the link. Zaaaaach?

unless something changed in fastai 2, it’s not meant to do that, it’s meant to recognise multiple classes at once, but still only from what you’ve trained it on. last years’ course did this with satellite images, and would tell you, for example, that your image was rural and cloudy and had buildings.


I do: https://github.com/muellerzr/Practical-Deep-Learning-for-Coders-2.0/blob/master/Computer%20Vision/03_Unknown_Labels.ipynb

The goal of multi-label is to search for all possible labels in the photo. This includes none at all. If you check out fastbook ch 6 (multicat), it talks about how to find the best threshold for your loss function (and metric) in order to accurately portray what you’re trying to do.


Yay. I had issues with this in v1, but I was probably being special.

1 Like

Nah it was much harder to pull off in v1 :slight_smile: