I have a group of images. All contain some common object (let's assume all at the same size and no other alterations). I want to train a CNN that will learn the filter for the common object and gives me back a boolean flag of whether it exists in a given image or not.
(for simplicity, I assume the "object" is smaller than 5x5 pixels)
I thought of something like:
- A Conv layer with 1 filter of 5x5
- A MaxPooling layer with pool_size = input size (meaning - returns a single value: the maximal activation of the filter)
- Output max activation (or a variation of it)
- Would you output the raw max activation and use a threshold to decide? sigmoid of it? or force the network to output "object" and "no_object" classes and do softmax?
- Quite related - what loss function?
- Is it a problem to have a large MaxPooling layer (one that reduces all activation to a single one)? What happens to the gradient on backprop?
It seems like it would just go randomly to one of the activations and I'm not sure that it can "learn" the object that way..
I'm wondering how to look at this problem as it's not really a 2-class classification problem. Even if I can come up with images that doesn't contain the object, there is nothing to "learn" from this class except of the fact that it doesn't contain something (which is a valuable information here, I must agree).
I've tried playing with it on simulated small black-white images and a cross "object" that I randomly added. Couldn't get the filter to learn the cross pattern although on some tries it got the horizontal line..
Any idea would help! Thanks!