I was trying to create a dataset for animal detection using convolution neural network. It was for some open source project. For the training and testing, I thought to create a dataset myself. for example , a dataset of 500 cats, 500 dogs, and 500 cows as an initial dataset. While creating a dataset , I got the confusion about the position of animals in the image. In the digit recognition, it is said that the digit should be centered.My doubt is whether that is necessary??whether the neural network could be trained by images in which objects are not centered. Or is there any conventions in creating a dataset for neural network??

enter image description here

Above given an image of MNIST digit identification where the digits are centered.

I just want to know whether could I add images like the below (object is not centered and also occluded) to my cow detection dataset?? Or is there any mechanism to create good dataset for an image recognition problem using neural networks?? enter image description here


1 Answer 1


Yes you can use these images. CNN's are translation invariant and don't require centered images.

Convolution Neural networks are translation invariant both because they use:

1) Shared weights[Convolution Filters]: So if you learn that a particular feature is sensitive to cow's head in a particular part of the image, the shared weights ensure that the feature is sensitive to cow's head in any part of the image. However this alone does not give invariance to translation. Say you apply the same filter to six parts of the image, and supply them as features to next layer of the neural network, you can get [0 0 0 0 0 1] or [1 0 0 0 0 0 ] depending on the position of the cows head, and thus problem of learning translation in variance is still there. This just ensures that features learnt to detect cow's head in one location in training image, can be used in any part of the image during test time.

2) Pooling: This actually ensures translation in variance by choosing the maximum activation of the same filter at nearby 4 locations.

Through a series of convolution and pooling operations we become insensitive to the location of the object in the original image and thus position does not matter at all.

  • $\begingroup$ Thank you Amitoz, it was a nice description. I will do accordingly. $\endgroup$ Commented May 16, 2016 at 4:06

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.