# Fine-tuning a CNN for recognizing two classes, but also being able to tell if none of them is present in an image

I need to fine-tune a CNN to classify two classes: dogs and cats, for example. However, I want the CNN to be able to tell if there are no dogs nor cats in a given image. Hence, I'm thinking of using a third class called background.

The goal is to fine-tune the network with lots of images: images of cats go to the cat class, images of dogs go to the dog class, and every other image goes to the background class.

This way, the fine-tuned network would be able to classify a dog as a dog, a cat as a cat, and (hopefully) everything else as background.

Is this the right way to do it? Would it work? I can't seem to find reliable information about this online.

My problem is a little bit more complicated, but knowing this would be a very good start.