Answers.Body: <p>The channel sizes 32, 128, etc. are used because of memory and efficiency. There is nothing holy about these numbers.</p>
  <p>The intuition behind choosing the number of channels is as follows-
  The initial layers extract low-level features- they consist of edge detectors, etc. There aren't many such features. So, we won't gain much by adding a lot of filters (of course, if we use a 3x3 filters on an RGB image, we would have <span class="math-container">$2^{27}$</span> different filters even if our neurons have only 0 and 1 as their values. However, most of them are quite similar/meaningless for our job). <strong>Using a lot of filters might even lead to overfitting.</strong></p>
  <p>The latter layers are responsible for detecting more nuanced features, like elbows/nose shape from the lower level features extracted previously. So, we might do better if we increase the number of channels. Also, note that the resultant layers become more and more sparse as we go deeper.</p>
  <p>Though it might differ in applications like super resolution image, <strong>in general, the number of channels stays the same or increases when we go deeper.</strong></p>
  <p>A nice experiment would be to try and increase the number of channels until you get no more benefit from it. I believe there was a paper that did exactly this (please cite it if someone remembers). You could even try to visualise the filters at this stage and see if the filters are similar or not.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-06T02:00:42.353Z
Answers.Text: You say "So, we might do better if we increase the number of channels.", but why is that the case? Why would we need more filters to detect these high-level features? Are there more high-level features than low-level ones? I think that this answer would also be improved, in terms of reliability, if you cite 1-2 papers that use a CNN that has more filters as we go deeper, but the spatial dimensions decrease. For instance, you can take u-net (which has an encoder part that follows the pattern that you describe). I am sure you can find other better examples online.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-06T05:50:49.383Z
Answers.Text: Yes. Increasing the number of channels won't have much effect since you keep increasing the channel dimension and keep reducing the height and width of the image. It would be useful to look at 1x1 filters that were used to resolve this issue.
Answers.UserDisplayName: Aniket Velhankar
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-06T05:53:09.733Z
Answers.Text: A couple of good reads are [EfficientNet paper](https://arxiv.org/pdf/1905.11946.pdf) and understanding how CNN's work by referring this [blog post](https://distill.pub/2017/feature-visualization/)
Answers.UserDisplayName: Aniket Velhankar
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-08T10:43:53.210Z
Answers.LastActivityDate: 2022-01-14T09:37:30.033Z
Answers.LastEditDate: 2022-01-14T09:37:30.033Z
Answers.UserDisplayName: cybershiptrooper
Body: <p>After having chosen the number of layers for a convolutional neural network, we must also choose the number of filters/channels for each convolutional layer.</p>
  <p>The intuition behind the filter's spatial dimension is the number of pixels in the image that must be considered to perform the recognition/detection task.</p>
  <p>However, I still can't find the intuition behind the number of filters. The numbers 128 and 256 are often used in the literature, but why?</p>
  
Tags: <convolutional-neural-networks><hyper-parameters><filters><convolutional-layers>
Title: What is the intuition behind the number of filters/channels for each convolutional layer?
UserDisplayName: yuri
ThreadText: # What is the intuition behind the number of filters/channels for each convolutional layer?
  
  (Asked by: username_0 on 2020-09-08)
  
  After having chosen the number of layers for a convolutional neural network, we must also choose the number of filters/channels for each convolutional layer.
  
  The intuition behind the filter's spatial dimension is the number of pixels in the image that must be considered to perform the recognition/detection task.
  
  However, I still can't find the intuition behind the number of filters. The numbers 128 and 256 are often used in the literature, but why?
  
  **Tags:** convolutional-neural-networks, hyper-parameters, filters, convolutional-layers
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-09-08. Score: 2 | Accepted answer
  
  The channel sizes 32, 128, etc. are used because of memory and efficiency. There is nothing holy about these numbers.
  
  The intuition behind choosing the number of channels is as follows-
  The initial layers extract low-level features- they consist of edge detectors, etc. There aren't many such features. So, we won't gain much by adding a lot of filters (of course, if we use a 3x3 filters on an RGB image, we would have $2^{27}$ different filters even if our neurons have only 0 and 1 as their values. However, most of them are quite similar/meaningless for our job). **Using a lot of filters might even lead to overfitting.**
  
  The latter layers are responsible for detecting more nuanced features, like elbows/nose shape from the lower level features extracted previously. So, we might do better if we increase the number of channels. Also, note that the resultant layers become more and more sparse as we go deeper.
  
  Though it might differ in applications like super resolution image, **in general, the number of channels stays the same or increases when we go deeper.**
  
  A nice experiment would be to try and increase the number of channels until you get no more benefit from it. I believe there was a paper that did exactly this (please cite it if someone remembers). You could even try to visualise the filters at this stage and see if the filters are similar or not.
  
  > **Comments:**
  > **username_2**: You say "So, we might do better if we increase the number of channels.", but why is that the case? Why would we need more filters to detect these high-level features? Are there more high-level features than low-level ones? I think that this answer would also be improved, in terms of reliability, if you cite 1-2 papers that use a CNN that has more filters as we go deeper, but the spatial dimensions decrease. For instance, you can take u-net (which has an encoder part that follows the pattern that you describe). I am sure you can find other better examples online.  
  > **username_3**: Yes. Increasing the number of channels won't have much effect since you keep increasing the channel dimension and keep reducing the height and width of the image. It would be useful to look at 1x1 filters that were used to resolve this issue.  
  > **username_3**: A couple of good reads are [EfficientNet paper](https://arxiv.org/pdf/1905.11946.pdf) and understanding how CNN's work by referring this [blog post](https://distill.pub/2017/feature-visualization/)  
  
  ---
  
  