Is it possible to build a Convolutional Neural Network (using Keras, Tensorflow) that can give output as 1 for an image of a Cat and 0 for everything else?

How would the training set look like?
I mean, let's assume if the number of images of the Cat is ~1 million, then the number of images of "not a Cat" should be potentially trillion or even more.

More importantly, what classes of images should I include in the images that are labeled as "not a Cat", e.g. Dogs, Tigers, Zebras, Trees, Computers, Galaxies, etc?
Doesn't it mean that we should have an infinite number of training samples that represent "not a Cat"?

  • 1
    $\begingroup$ Let me try first $\endgroup$
    – 10xAI
    Jul 10 '20 at 15:29

It is possible to build that kind of a CNN. It is important to maintain uniform distribution for both the classes ('cat' and 'not cat'). That is you should have an almost equal number of samples for each of these classes to avoid biasing your model to the 'non-cat' class just because it has huge number of examples.

The number of non-cat examples can be potentially trillion because it's everything in the world apart from cat. You don't want to include those many examples in your training set just because trillions of examples are available. As I told, it's important to match the class distributions. You can choose any animal or object you want for the 'non-cat' class. You can even mix multiple classes for 'non-cat'.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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