How would I build a dog detector? (single category fine tuning)

If I wanted to build a dog detector based on VGG, as opposed to a dogs vs cats detector, would it just be a matter of fine tuning with a single “dogs” directory rather than dogs and cats directories?

If someone has tried this, any hints would be most welcome. Otherwise I’ll give it a shot and report my findings!

Right now, the Fast.ai model we build for Cats vs. Dogs Redux is a “binary classification” : it starts as “Dog or Cat” but could be “Dog or No-Dog” or a basic “Yes / No”.

Now this is beyond my academic knowledge but could you customize it further -and improve speed and accuracy ?- by tuning the False Negative/Positive component ?

Hi Traun,

It’s certainly possible to train a computer vision model on the binary classification task, “dog vs. not-dog.” But the approach you suggested (training or fine-tuning with only a single category) isn’t going to work. In particular, there’s something about selecting your training data that’s going to be tricky. To understand why, you need to think about the learning process: what is happening during training that allows the model to differentiate between different classes of things?

You didn’t mention where you are in the course. I think if you work through lessons 0-3 and pay close attention to how convolutions work and how gradient descent works, you’ll understand how you would need to approach this type of problem.

If my answer seems too cryptic or “hiding the ball,” let me know, and I’ll be happy to share more specific thoughts. I just didn’t want to deprive you of the experience of figuring this out for yourself. :slight_smile:

Good luck!

1 Like

Thanks Shawn, I just got an idea after reading your post – relabel all the non-dog ImageNet images as “NonDog” (I don’t mean just cats are non-dogs, I mean lizards, raccoons … sunsets … the rest of ImageNet basically!)

I haven’t tried it yet, but I’ll loop back after lesson 3 if it doesn’t pan out. I’m still on pass 2 of lesson 1, this time w/ an AWS instance.

1 Like

Hey Eric, check my response to Shawn below … would be curious to hear your thoughts.

That sounds like the right approach. For your ‘non dog’ category you should only include the kinds of objects that you’re likely to see in practice in your application.

1 Like