I want to build a model which is able to detect the presence of a specific object in the image without caring about the location (i.e. no bounding boxes, just 0/1 output). More specifically, the object is always the same and it is characterized by a specific pattern (e.g. a national flag or a bar code). The algorithm should be robust to scale, rotation and distortion. What is the best architecture in this case? Is there something better than a generic CNN binary classifier?
It mostly depends on the amount of data you have available for training.
However, unless you have an extremely limited dataset and you are unable to generate synthetic data, CNNs are currently the best approach for solving your task. With sufficient data, they are very robust. To improve their performance, you can augment your dataset by randomly rotating, flipping, brightening, contrasting, scaling, cropping, blurring, and adding noise to the images throughout training.
It also depends on your speed requirements and computational resources. Traditional methods have the potential to be quite fast, but if you only care about accuracy, a deep network would probably perform better. Note that some CNNs are also quite fast, such as MobileNets.
There are a few reasons you might go "old school" and use template matching and more traditional approaches as suggested by @TheDjentleman:
- You do not have enough data to make a CNN robust AND you cannot generate synthetic data
- CNNs do not meet your speed requirements AND the traditional methods do
- You do not have sufficient resources to train a deep network, such as GPU(s). FYI Google developed a cloud computing tool for researchers and developers at a pretty reasonable cost.
If none of those criteria fit your situation, go with a CNN.
Lastly, you do not necessarily need a generic binary classification CNN. You can use an object detection network or even a semantic segmentation network and just ignore the location data if you do not need it.
May not really answer you question, but to be honest, if you just want to find one specific object that you know beforehand, I wouldn't use a neural network at all (in my opinion you should use the right tool for a task).
For easier tasks like this, you can use more "old school" methods (boo) like template matching. With such approaches you just take an isolated image of your object and, for example, extract a set of features (e.g. using opencv) and then move a rectangle over images where you want to find that object and just compare features. The advantage of such approaches is that you do not really need training data, like you would for training a neural network.
If you really, really, really want to use a CNN, you could try to just paste an image of your object into thousands of random images and then take even more images to train a classifier that examines if the object is in the image or not.