4
$\begingroup$

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.

$\endgroup$

1 Answer 1

2
$\begingroup$

Actually you are in the right path but in the question you are wrong in the second paragraph.

What you should do is as follows:

  • change the output layer to 4 classes, dogs, cats, dogs and cats, none.
  • If you have so many data, don't freeze the convolutional layers and train them all but if not, freeze them and fine tune the last layers, maybe just the dense layers.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.