Skip to content

Convolutional Neural Network

Why prefer CNN over ANN

Multiple parameters to calculate - More computation and space

Convolutional Operation in CNN

A kernel goes over the image, whose products are summed to detect the features

$$Dim = (n - f + 1) * (n-f+1)$$

Pasted image 20260427033900.png

Padding in CNN

Some pixels do not get enough attention when the kernel moves over the image, so we introduce padding to the image.

Pasted image 20260427035037.png

1) Valid Convolution - No padding 2) Same Convolution - The output should have the same size of input image after padding

$$ \begin{aligned} n'=n+2p\ n+2p-f+1=n\ n=(f-1)/2 \end{aligned} $$

Stride in CNN

Stride determines the skips taken by kernel while moving over the image. It is used for down-sampling (reducing feature map size), improving computational efficiency

$$ Dim=(n-f)/s +1$$

Max Pooling in CNN

Max pooling is a downsampling technique in convolutional neural networks (CNNs) that reduces spatial dimensions (height/width) by taking the maximum value from sliding windows.

Pasted image 20260427040404.png

1) Reduce image size, thus reduce computational cost 2) Enhances Features 3) No parameters involved, thus no training 4) Same number of channels

CNN Architecture

Pasted image 20260427041144.png

Pasted image 20260427041817.png

Pasted image 20260427132301.png

Calculating Parameters in CNN

$$\begin{aligned} Parameters=(k_wk_hCin+1)C_{cout}\ Parameters = (inout+1) \end{aligned}$$