Answers.Body: <p>The translational invariance comes from the fact that the kernels are applied everywhere. Basically the kernels are "translated", i.e. shifted, and that means the feature they detect are detected everywhere.</p>
  
  <p>Pooling may help with that in some cases, because in the end you need a dog at the right side to activate the same neuron as a dog on the left, so there needs to be funnelling of the information, but it is not strictly necessary. You could also imagine a CNN with a dog kernel in a late layer, which just recognises dogs everywhere, with no pooling necessary. </p>
  
  <p>Fully connected networks are wasteful in that they don't share weights. To get the necessary translational invariance you therefore need to learn pretty much the same weights at all positions. But they do preserve the spatial relationship between pixels.</p>
  
  <p>Pooling reduces the dimensionality, but it also forgets the precise position of a feature. This might help with generalisation, but I'm not sure whether that's a big factor. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-13T06:32:13.060Z
Answers.Text: Convolutional layers actually provide *equivariance* while pooling layers provide approximate *invariance*. This answer should be seriously revised.
Answers.UserDisplayName: gunes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-14T09:47:16.067Z
Answers.Text: Well, go and write your own answer.
Answers.UserDisplayName: BlindKungFuMaster
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-04T20:20:47.857Z
Answers.Text: @gunes Can you explain why pooling layers provide translation invariance?
Answers.UserDisplayName: Antonios Sarikas
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-02T12:31:02.923Z
Answers.LastActivityDate: 2017-09-02T12:31:02.923Z
Answers.UserDisplayName: BlindKungFuMaster
Body: <p>I'm currently in the process of learning about using CNNs in image recognition. Many of the different resources I read that were explaining the motivation referred to the fact that these networks are (to some degree) translationally invariant. My understanding is as follows:</p>
  
  <ul>
  <li>Fully connected networks are ill-suited to image recognition because of the high dimensionality of the data and especially because they do not preserve the spatial relationships between pixels. I care about the state of the pixels surrounding pixel X as well as X itself.</li>
  <li>CNNs remedy this because they look at the image in 2 dimensions so that surrounding pixels are being considered as well (the kernel does this). However, while I care about what is around X, I don't care where X is. So, I apply the kernel the same everywhere and I make a bunch of layers so that I can get a bunch of kernels.</li>
  <li>I also use pooling. This reduces the data dimensions but also adds some of that translation invariance.</li>
  </ul>
  
  <p>So, my question is: What feature of the CNN is causing the invariance? I saw some explanations saying it was a result of the maps basically activating when a certain feature shows up, regardless of where. Other said that the pooling meant that if a horizontal line, for instance, showed up in one place vs. a pixel over, the pooling would activate the same for both. It seems like the first reason would be totally sufficient and the second not really adequate but I could also see it being both.</p>
  
  <p>I also read a paper (<a href="https://arxiv.org/pdf/1606.09549.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1606.09549.pdf</a>) about fully-convolutional networks. In section 2.1, the authors explain that they intentionally chose to make it fully-convolutional because that allowed them to "compute the similarity at all translated sub-windows on a dense grid in a single evaluation."</p>
  
  <p>That sentence makes me think that it is more the first explanation. Anyways, I hope to gain a better intuitive understanding of how the different parts of the CNN come together to work particularly well on images. Thanks!</p>
  
Tags: <image-recognition><convolutional-neural-networks>
Title: Intuitively understanding translational invariance in CNNs
UserDisplayName: pshlady
ThreadText: # Intuitively understanding translational invariance in CNNs
  
  (Asked by: username_0 on 2017-09-01)
  
  I'm currently in the process of learning about using CNNs in image recognition. Many of the different resources I read that were explaining the motivation referred to the fact that these networks are (to some degree) translationally invariant. My understanding is as follows:
  
  * Fully connected networks are ill-suited to image recognition because of the high dimensionality of the data and especially because they do not preserve the spatial relationships between pixels. I care about the state of the pixels surrounding pixel X as well as X itself.
  * CNNs remedy this because they look at the image in 2 dimensions so that surrounding pixels are being considered as well (the kernel does this). However, while I care about what is around X, I don't care where X is. So, I apply the kernel the same everywhere and I make a bunch of layers so that I can get a bunch of kernels.
  * I also use pooling. This reduces the data dimensions but also adds some of that translation invariance.
  
  So, my question is: What feature of the CNN is causing the invariance? I saw some explanations saying it was a result of the maps basically activating when a certain feature shows up, regardless of where. Other said that the pooling meant that if a horizontal line, for instance, showed up in one place vs. a pixel over, the pooling would activate the same for both. It seems like the first reason would be totally sufficient and the second not really adequate but I could also see it being both.
  
  I also read a paper (<https://arxiv.org/pdf/1606.09549.pdf>) about fully-convolutional networks. In section 2.1, the authors explain that they intentionally chose to make it fully-convolutional because that allowed them to "compute the similarity at all translated sub-windows on a dense grid in a single evaluation."
  
  That sentence makes me think that it is more the first explanation. Anyways, I hope to gain a better intuitive understanding of how the different parts of the CNN come together to work particularly well on images. Thanks!
  
  **Tags:** image-recognition, convolutional-neural-networks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-09-02. Score: 2 | Accepted answer
  
  The translational invariance comes from the fact that the kernels are applied everywhere. Basically the kernels are "translated", i.e. shifted, and that means the feature they detect are detected everywhere.
  
  Pooling may help with that in some cases, because in the end you need a dog at the right side to activate the same neuron as a dog on the left, so there needs to be funnelling of the information, but it is not strictly necessary. You could also imagine a CNN with a dog kernel in a late layer, which just recognises dogs everywhere, with no pooling necessary.
  
  Fully connected networks are wasteful in that they don't share weights. To get the necessary translational invariance you therefore need to learn pretty much the same weights at all positions. But they do preserve the spatial relationship between pixels.
  
  Pooling reduces the dimensionality, but it also forgets the precise position of a feature. This might help with generalisation, but I'm not sure whether that's a big factor.
  
  > **Comments:**
  > **username_2**: Convolutional layers actually provide *equivariance* while pooling layers provide approximate *invariance*. This answer should be seriously revised.  
  > **username_1**: Well, go and write your own answer.  
  > **username_3**: @username_2 Can you explain why pooling layers provide translation invariance?  
  
  ---
  
  