I am building a CNN and I want to maintain translational variance. Most CNNs use pooling and stride which allows for the useful side effect of translational invariance, meaning that if a feature appears in a scene it will be picked up as the same feature. But what if the position of the feature in the scene is information I want to keep/maintain/learn? Do I just have a stride of 1 and don't do pooling? This question is similar: Translational variance in convolutional neural networks
1 Answer
If you don't need exact position, you can use any CNN, but you need to be sure what you are doing.
Firstly, convolution is local, but in deeper layers each neuron is processing information from larger part of the input image. You can calculate the size of such part for each layer (it is increased both by convolution and pooling), and reduce the depth of the convolution part of the network accordingly (or use smaller kernels etc.). Basically, you don't want a situation where convolution neurons are processing information from a whole input image, then the spatial positions are probably lost.
For example if you have an image of size 28x28, like in MNIST data. If you use a CNN with a single convolution 5x5 (with padding) and 2x2 pooling, each neuron in 14x14 map of the result contains information from at most 6x6 part of the input image (less if it processed padded zeros)
-
$\begingroup$ The location of my feature is really important for me to keep. $\endgroup$– ashleyJun 29, 2017 at 19:18
-
$\begingroup$ What do you mean by "keep"? If you want to extract different objects with their exact positions and whole shapes, you have a segmentation task, there are CNNs made for that too. $\endgroup$ Jun 29, 2017 at 20:12
-
$\begingroup$ Same object in different positions. I am only looking at one object in different positions. The positions play a role in how I can further interact with the object. i.e. the position of view is important which sets the position and orientation of the object. $\endgroup$– ashleyJun 30, 2017 at 13:16