2
$\begingroup$

I'm trying to understand the convolutional neural network and especially its parameters. I found several formulas on the internet, but I cannot understand them. For example:

((filter_size*filter_size)*stride+1)*filters)

What is the number of filters here? Does it mean, that we train different size*size weights for every stride that we do, and the total number of strides will be the number of filters?

$\endgroup$

1 Answer 1

1
$\begingroup$

A convolutional layer is composed of a grid of numbers called filter (or kernel). This is the filter that scans the image (talking about 2D convolutions here). Applying means simply multiplying the values of each pixel of the filter with the corresponding values of the image. For a visual explanation of this process of applying the filter to the image, check this video.

Stride refers to the number of pixels between each application of the filter. For this, I will also refer to the video above. If we have a 5x5 image and 3x3 filter; stride = 1 refers to centering the filter on each of the 25 pixels in the image. stride = 2 on the other hand skips centering on the pixel at each step. Check this video for a visual explanation of stride.

Applying the filter to the entire image finishes the processing of the filter. But usually, we have multiple filters at each layer to capture different features which means applying the above procedure again for a different filter.

Filter size can be anything from 1x1 to 5x5 for a 5x5 image. 1x1 is a little meaningless but still possible.

A good explanation of the terms used in CNNs is also given in this article. And finally, you can find a good discussion on calculating the number of parameters in a convolutional layer here.

$\endgroup$
4
  • $\begingroup$ Is the number of different filters at each layer a hyperparameter? $\endgroup$
    – Igor Igor
    Oct 10, 2021 at 7:21
  • $\begingroup$ Anything defined manually (i.e. not trained) is a hyperparameter so yes, number of filters is also one. $\endgroup$
    – serali
    Oct 10, 2021 at 7:46
  • $\begingroup$ And how do we summarize results obtained by different filters to the final one? $\endgroup$
    – Igor Igor
    Oct 10, 2021 at 13:33
  • $\begingroup$ By a process called "flattening" but it is better if you ask it as a separate question. $\endgroup$
    – serali
    Oct 10, 2021 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.