Answers.Body: <p>All CNNs can be represented as vanilla networks on the flattened image data. Just to do so, you would need <strong>A LOT</strong> of parameters (most of which would be 0) for what CNNs do freely. You can think of a CNN as reusing a filter on a masked input (whichever receptive field it's looking at whatever point during the convolution) repetitively.  </p>
  
  <p>In other words, fully connected layers use <strong>all</strong> the information, so it can still learn spatial dependence as a CNN does, while CNNs for each neuron only look at a specific receptive field and will reuse that filter for all neurons in that channel. This constraint saves computation and allows wider and deeper models under some budget.</p>
  
  <p>This is nice because the hypothesis of why CNN's work are, is that at each point in the network we care about looking at localized features rather than global ones and that creating a composition of these makes it so even if each neuron only relates to a handful of neurons in the previous layer, the receptive field from the initial image can still be quite large if not the whole thing.</p>
  
  <p><strong>Take away:</strong> <em>CNNs are an efficient implementation of a vanilla NN, given the locality constraint that each neuron only looks at a small localized subset of neurons from the previous layer</em>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T00:19:42.877Z
Answers.Text: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/96006/discussion-on-answer-by-mshlis-can-a-vanilla-neural-network-theoretically-achiev).
Answers.UserDisplayName: Ben N
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-08T18:38:55.230Z
Answers.LastActivityDate: 2019-07-08T19:50:17.240Z
Answers.LastEditDate: 2019-07-08T19:50:17.240Z
Answers.UserDisplayName: mshlis
Body: <p>I perfectly understand that CNN takes into account the local dependency of each pixel to the nearby pixels. In addition, CNNs are spatially invariant which means that they are able to detect the same feature anywhere in the image. These qualities are useful in image classification problems given the nature of the problem. </p>
  
  <p>How does a vanilla neural net exactly falls short on these properties? Am I right in claiming that a vanilla neural net has to learn a given feature in every part of the image? This is different than how a CNN does it, which learns the feature once and then detects it anywhere in the image. </p>
  
  <p>How about local pixel dependancy? Why can't a vanilla neural network learn the local dependency by relating one pixel to its neighbors in the 1D input? </p>
  
  <p>In other words, is there more information present while training a CNN that are simply absent when training a normal NN? Or is a CNN just better at optimizing in the space of image classification problems? </p>
  
Tags: <neural-networks><deep-learning><convolutional-neural-networks><comparison>
Title: Can a vanilla neural network theoretically achieve the same performance as CNN?
UserDisplayName: Robot0110
ThreadText: # Can a vanilla neural network theoretically achieve the same performance as CNN?
  
  (Asked by: username_0 on 2019-07-08)
  
  I perfectly understand that CNN takes into account the local dependency of each pixel to the nearby pixels. In addition, CNNs are spatially invariant which means that they are able to detect the same feature anywhere in the image. These qualities are useful in image classification problems given the nature of the problem.
  
  How does a vanilla neural net exactly falls short on these properties? Am I right in claiming that a vanilla neural net has to learn a given feature in every part of the image? This is different than how a CNN does it, which learns the feature once and then detects it anywhere in the image.
  
  How about local pixel dependancy? Why can't a vanilla neural network learn the local dependency by relating one pixel to its neighbors in the 1D input?
  
  In other words, is there more information present while training a CNN that are simply absent when training a normal NN? Or is a CNN just better at optimizing in the space of image classification problems?
  
  **Tags:** neural-networks, deep-learning, convolutional-neural-networks, comparison
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-07-08. Score: 7 | Accepted answer
  
  All CNNs can be represented as vanilla networks on the flattened image data. Just to do so, you would need **A LOT** of parameters (most of which would be 0) for what CNNs do freely. You can think of a CNN as reusing a filter on a masked input (whichever receptive field it's looking at whatever point during the convolution) repetitively.
  
  In other words, fully connected layers use **all** the information, so it can still learn spatial dependence as a CNN does, while CNNs for each neuron only look at a specific receptive field and will reuse that filter for all neurons in that channel. This constraint saves computation and allows wider and deeper models under some budget.
  
  This is nice because the hypothesis of why CNN's work are, is that at each point in the network we care about looking at localized features rather than global ones and that creating a composition of these makes it so even if each neuron only relates to a handful of neurons in the previous layer, the receptive field from the initial image can still be quite large if not the whole thing.
  
  **Take away:** *CNNs are an efficient implementation of a vanilla NN, given the locality constraint that each neuron only looks at a small localized subset of neurons from the previous layer*.
  
  > **Comments:**
  > **username_2**: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/96006/discussion-on-answer-by-mshlis-can-a-vanilla-neural-network-theoretically-achiev).  
  
  ---
  
  