# Number of parameters in CNN

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?

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.

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