3
$\begingroup$

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?

$\endgroup$
0

1 Answer 1

2
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ 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. $\endgroup$
    – nbro
    Nov 6, 2020 at 2:00
  • $\begingroup$ 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. $\endgroup$ Nov 6, 2020 at 5:50
  • $\begingroup$ A couple of good reads are EfficientNet paper and understanding how CNN's work by referring this blog post $\endgroup$ Nov 6, 2020 at 5:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .