TransWikia.com

CNN Multi-class vs Binary Class Image Classification

Data Science Asked on April 22, 2021

Suppose we have a training set of 3 classes of image: 1.Cats, 2.Dogs, 3.Neither cats nor dogs.
We’re only really bothered about detecting whether an image is a cat/dog, or neither, but we don’t care whether it’s a cat or a dog, just that it’s one of the two.

Is it inherently “better” to train a binary class CNN by merging the Dog and Cat classes into a single “positive” class rather than train a 3-class CNN?

If it is, does it then follow that if we did care about whether the image was a dog or cat, it would also be better to first run the binary classifier to decide if it was a dog/cat or not, then run a second binary classifier trained on just cats and dogs to decide which of the two it actually is?

One Answer

I would train one classifier with 3 classes:

cat, dog, neither

Use cross entropy as your cost function.

There are many examples of this online. If you Google MNIST neural network you'll find many simple examples. Or you can take one of Google's trained networks and retrain the last layer.

Here is a convolutional being trained on the Cifar set of images.

Using a pre-trained network to tell two house cats apart.

Answered by Linda MacPhee-Cobb on April 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP