Answers.Body: <p>The <a href="https://ai.stackexchange.com/a/18796/2444">other answer</a> gives a good overview of the differences between MLPs and CNNs, and it includes 2 diagrams that attempt to illustrate the main differences between MLPs and CNNs, i.e. sparse connectivity and weight sharing. However, these diagrams do not clarify what a <strong>neuron</strong> in a CNN could be. A better diagram, which illustrates what a neuron is in a CNN, from a CNN <em>and</em> MLP perspective, is the following (taken from <a href="https://cs231n.github.io/convolutional-networks/" rel="nofollow noreferrer">the famous article on CNNs</a>).</p>
  <p><a href="https://i.sstatic.net/o2CwW.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/o2CwW.jpg" alt="enter image description here" /></a></p>
  <p>Here, there are 2 main blocks (aka volumes): the orange block on the left (the input) and the blue/cyan volume on the right (the <strong>feature maps</strong>, i.e. the outputs of the convolutional layer, i.e. after the application of the convolutions with different kernels).</p>
  <p>The <em>circles</em> in the visible stack of the cyan block represent the neurons (or, more precisely, their <strong>activations</strong> or outputs). We only see <span class="math-container">$k=5$</span> neurons stacked: this corresponds to the application of <span class="math-container">$k=5$</span> different kernels (i.e. weights) to that specific subset of the input (aka <a href="https://www.youtube.com/watch?v=70A3uYfM1qA" rel="nofollow noreferrer"><strong>receptive field</strong></a>), hence the <strong>sparse connectivity</strong> of CNNs. So, these neurons, in the same stack, are looking at the same small subset of the input, but with different weights (i.e. kernels). The neurons, which are not shown in this diagram, that are on the same (vertical) 2d plane (known as <strong>feature map</strong>) of the same neuron (e.g. the first that we see from left to right) in the cyan volume are the neurons that share the same weights, i.e. we use the same kernel to produce their outputs.</p>
  <p>So, in this biological/neuroscientific view of the CNN, when you apply <a href="https://ai.stackexchange.com/q/21999/2444">the convolution (or cross-correlation) operation</a> with 1 specific filter (or kernel), you are computing the activation (not to be confused with the <em>activation function</em>, which is used to compute the activation!) i.e. the output of multiple neurons, all of them share the same weights. You stack all these activations on the same 2d plane (known as <strong>feature map</strong>) of the output volume: note that this operation is just the convolution operation! When you compute the convolution with another kernel, you are again computing the activation of other multiple neurons, which share <em>another different</em> weight matrix, and so on and so forth.</p>
  <p>Some authors prefer to use the term <a href="https://www.deeplearningbook.org/contents/convnets.html" rel="nofollow noreferrer"><strong>convolutional networks</strong></a>, i.e. without the term <strong>neural</strong>, probably because of this issue, i.e. it's not clear, especially to newcomers, what a neuron would be in a CNN, so the neuroscientific/biological view of CNNs is not always clear, although it's important to emphasize that <a href="https://ai.stackexchange.com/a/24969/2444">CNNs were inspired by the visual cortext</a>, so this biological interpretation could (and should) be more widely known or less confusing/misunderstood.</p>
  <p>Now, let's address your question more directly.</p>
  <blockquote>
  <p>Aren't the filters the same, in the way that they convert an &quot;image&quot; to a new &quot;image&quot; based on the weights that are in that filter? And that the next layer uses this new &quot;image&quot;?</p>
  </blockquote>
  <p>The filters in a CNN correspond to the weights of an MLP.</p>
  <p>A neuron in a CNN can be viewed as performing exactly the same operation as a neuron in an MLP. The big differences between a CNN and an MLP (as explained also in <a href="https://ai.stackexchange.com/a/18796/2444">the other answer</a>) are</p>
  <ul>
  <li><p><strong>Weight sharing</strong>: Some neurons (not all!) in the same convolutional layer share the same weights. The convolution (or cross-correlation) is the operation that implements this partial forward pass with the same weights for different neurons.</p>
  </li>
  <li><p>Neurons in a CNN only look at a <strong>subset</strong> of the input and not all inputs (i.e. receptive field), which leads to some notion of <strong>sparse connectivity</strong></p>
  </li>
  <li><p>A convolutional layer, in a CNN, is composed of neurons in a <strong>3d dimensional</strong> volume (or, more precisely, their activations are organized in a 3d volume), rather than a 1-dimensional one, as in an MLP.</p>
  </li>
  <li><p>CNNs may use subsampling (aka pooling)</p>
  </li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-19T16:17:27.547Z
Answers.LastActivityDate: 2021-10-13T11:24:34.570Z
Answers.LastEditDate: 2021-10-13T11:24:34.570Z
Answers.UserDisplayName: nbro
Answers.Body: <p><strong>tl;dr</strong> The equivalent to a neuron in a Fully-Connected (FC) layer is the <strong>kernel</strong> (or filter) of a Convolution layer</p>
  <h3>Differences</h3>
  <p>The neurons of these two types of layers have two key differences. These are that the convolution layers implement:</p>
  <ul>
  <li><strong>Sparse connectivity</strong>, i.e. each neuron is connected only to an area of the input, not the whole.</li>
  <li><strong>Weight sharing</strong>, i.e. <em>similar</em> connections end up having the same weights. This is usually visualized as the same filter traversing the image.</li>
  </ul>
  <p>Besides these two key differences, there are some other technical details, e.g. <a href="https://stackoverflow.com/a/45140686/5668710">how the biases are implemented</a>. Other than that they perform the same operation.</p>
  <p>What causes some confusion is that the input of a CNN is usually 2 or 3-dimensional, while a FC is usually 1-dimensional. These aren't mandatory however. To better help visualize the differences between the two I made a couple of figures illustrating the differences between a conv-layer and a FC one, both in 1D.</p>
  <h3>Sparse connectivity</h3>
  <p>On the left are two FC neural networks. On the right, are layers with sparse connections.</p>
  <p><img src="https://i.sstatic.net/bpOW7.png" alt="" /></p>
  <h3>Weight sharing</h3>
  <p>On the left is a sparsely connected network. The colors represent the different values of the weights. On the right is the same network with weight-sharing. Note that similar weights (i.e. arrows with the same direction in each layer) have the same value.</p>
  <p><img src="https://i.sstatic.net/cnYPq.png" alt="" /></p>
  <hr />
  <p>To answer your other questions:</p>
  <blockquote>
  <p>Are filters not the same in the way that they convert an &quot;image&quot; to a new &quot;image&quot; based on the weights that are in that filter? And that the next layers use these new &quot;images&quot;?</p>
  </blockquote>
  <p>Yes, if the input of a convolution layer is an image, so will the output. The next layer will also operate on an image.</p>
  <p>However, I'd like to note that not all convolution layers accept images as their inputs. There are 1D and 3D convolutional layers as well.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-25T13:31:43.563Z
Answers.LastActivityDate: 2021-05-15T11:29:20.787Z
Answers.LastEditDate: 2021-05-15T11:29:20.787Z
Answers.UserDisplayName: Djib2011
Body: <p>I know they are not the same in working, but an input layer sends the input to <span class="math-container">$n$</span> neurons with a set of weights, based on these weights and the activation layer, it produces an output that can be fed to the next layer.</p>
  <p>Aren't the filters the same, in the way that they convert an &quot;image&quot; to a new &quot;image&quot; based on the weights that are in that filter? And that the next layer uses this new &quot;image&quot;?</p>
  
Tags: <convolutional-neural-networks><multilayer-perceptrons><artificial-neuron><weights><filters>
Title: Can neurons in MLP and filters in CNN be compared?
UserDisplayName: Tibo Geysen
ThreadText: # Can neurons in MLP and filters in CNN be compared?
  
  (Asked by: username_0 on 2020-03-24)
  
  I know they are not the same in working, but an input layer sends the input to $n$ neurons with a set of weights, based on these weights and the activation layer, it produces an output that can be fed to the next layer.
  
  Aren't the filters the same, in the way that they convert an "image" to a new "image" based on the weights that are in that filter? And that the next layer uses this new "image"?
  
  **Tags:** convolutional-neural-networks, multilayer-perceptrons, artificial-neuron, weights, filters
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-03-25. Score: 4 | Accepted answer
  
  **tl;dr** The equivalent to a neuron in a Fully-Connected (FC) layer is the **kernel** (or filter) of a Convolution layer
  
  ### Differences
  
  The neurons of these two types of layers have two key differences. These are that the convolution layers implement:
  
  * **Sparse connectivity**, i.e. each neuron is connected only to an area of the input, not the whole.
  * **Weight sharing**, i.e. *similar* connections end up having the same weights. This is usually visualized as the same filter traversing the image.
  
  Besides these two key differences, there are some other technical details, e.g. [how the biases are implemented](https://stackoverflow.com/a/45140686/5668710). Other than that they perform the same operation.
  
  What causes some confusion is that the input of a CNN is usually 2 or 3-dimensional, while a FC is usually 1-dimensional. These aren't mandatory however. To better help visualize the differences between the two I made a couple of figures illustrating the differences between a conv-layer and a FC one, both in 1D.
  
  ### Sparse connectivity
  
  On the left are two FC neural networks. On the right, are layers with sparse connections.
  
  ![](https://i.sstatic.net/bpOW7.png)
  
  ### Weight sharing
  
  On the left is a sparsely connected network. The colors represent the different values of the weights. On the right is the same network with weight-sharing. Note that similar weights (i.e. arrows with the same direction in each layer) have the same value.
  
  ![](https://i.sstatic.net/cnYPq.png)
  
  ---
  
  To answer your other questions:
  
  > Are filters not the same in the way that they convert an "image" to a new "image" based on the weights that are in that filter? And that the next layers use these new "images"?
  
  Yes, if the input of a convolution layer is an image, so will the output. The next layer will also operate on an image.
  
  However, I'd like to note that not all convolution layers accept images as their inputs. There are 1D and 3D convolutional layers as well.
  
  
  ---
  
  ### Answer by username_1 on 2021-01-19. Score: 0
  
  The [other answer](https://ai.stackexchange.com/a/18796/2444) gives a good overview of the differences between MLPs and CNNs, and it includes 2 diagrams that attempt to illustrate the main differences between MLPs and CNNs, i.e. sparse connectivity and weight sharing. However, these diagrams do not clarify what a **neuron** in a CNN could be. A better diagram, which illustrates what a neuron is in a CNN, from a CNN *and* MLP perspective, is the following (taken from [the famous article on CNNs](https://cs231n.github.io/convolutional-networks/)).
  
  [![enter image description here](https://i.sstatic.net/o2CwW.jpg)](https://i.sstatic.net/o2CwW.jpg)
  
  Here, there are 2 main blocks (aka volumes): the orange block on the left (the input) and the blue/cyan volume on the right (the **feature maps**, i.e. the outputs of the convolutional layer, i.e. after the application of the convolutions with different kernels).
  
  The *circles* in the visible stack of the cyan block represent the neurons (or, more precisely, their **activations** or outputs). We only see $k=5$ neurons stacked: this corresponds to the application of $k=5$ different kernels (i.e. weights) to that specific subset of the input (aka [**receptive field**](https://www.youtube.com/watch?v=70A3uYfM1qA)), hence the **sparse connectivity** of CNNs. So, these neurons, in the same stack, are looking at the same small subset of the input, but with different weights (i.e. kernels). The neurons, which are not shown in this diagram, that are on the same (vertical) 2d plane (known as **feature map**) of the same neuron (e.g. the first that we see from left to right) in the cyan volume are the neurons that share the same weights, i.e. we use the same kernel to produce their outputs.
  
  So, in this biological/neuroscientific view of the CNN, when you apply [the convolution (or cross-correlation) operation](https://ai.stackexchange.com/q/21999/2444) with 1 specific filter (or kernel), you are computing the activation (not to be confused with the *activation function*, which is used to compute the activation!) i.e. the output of multiple neurons, all of them share the same weights. You stack all these activations on the same 2d plane (known as **feature map**) of the output volume: note that this operation is just the convolution operation! When you compute the convolution with another kernel, you are again computing the activation of other multiple neurons, which share *another different* weight matrix, and so on and so forth.
  
  Some authors prefer to use the term [**convolutional networks**](https://www.deeplearningbook.org/contents/convnets.html), i.e. without the term **neural**, probably because of this issue, i.e. it's not clear, especially to newcomers, what a neuron would be in a CNN, so the neuroscientific/biological view of CNNs is not always clear, although it's important to emphasize that [CNNs were inspired by the visual cortext](https://ai.stackexchange.com/a/24969/2444), so this biological interpretation could (and should) be more widely known or less confusing/misunderstood.
  
  Now, let's address your question more directly.
  
  > Aren't the filters the same, in the way that they convert an "image" to a new "image" based on the weights that are in that filter? And that the next layer uses this new "image"?
  
  The filters in a CNN correspond to the weights of an MLP.
  
  A neuron in a CNN can be viewed as performing exactly the same operation as a neuron in an MLP. The big differences between a CNN and an MLP (as explained also in [the other answer](https://ai.stackexchange.com/a/18796/2444)) are
  
  * **Weight sharing**: Some neurons (not all!) in the same convolutional layer share the same weights. The convolution (or cross-correlation) is the operation that implements this partial forward pass with the same weights for different neurons.
  * Neurons in a CNN only look at a **subset** of the input and not all inputs (i.e. receptive field), which leads to some notion of **sparse connectivity**
  * A convolutional layer, in a CNN, is composed of neurons in a **3d dimensional** volume (or, more precisely, their activations are organized in a 3d volume), rather than a 1-dimensional one, as in an MLP.
  * CNNs may use subsampling (aka pooling)
  
  
  ---
  
  