Back to Study Material Deep Learning

CNN

A Convolutional Neural Network, or CNN, is a deep learning architecture specially designed for processing data with a grid-like structure, most commonly im...

CNN

Convolutional Neural Networks for Image Data

A Convolutional Neural Network, or CNN, is a deep learning architecture specially designed for processing data with a grid-like structure, most commonly images. Instead of connecting every neuron to every input, a CNN uses small learnable filters, called kernels, that slide across the input and detect local features such as edges, textures, and shapes.

A convolutional layer applies multiple filters to the input. Each filter produces a feature map highlighting where a particular pattern appears in the image. A filter that detects vertical edges will produce a bright response wherever vertical lines exist in the image. With many filters stacked together, the network builds a rich description of visual content.

After convolution, a pooling layer reduces the spatial dimensions of the feature maps, making computation cheaper and the representation more robust to small shifts in position. Max pooling is the most common method: it divides the feature map into small windows and keeps only the maximum value in each window.

Deep CNNs stack multiple convolutional and pooling layers. Early layers capture low-level features like edges and colours. Deeper layers capture high-level concepts like object parts and entire objects. At the end, one or more fully connected layers combine all spatial features into a final classification decision.

A concrete example: the LeNet architecture was one of the earliest CNNs, designed to recognise handwritten digits for postal code reading. It used two convolutional layers followed by pooling and fully connected layers, achieving accuracy far beyond previous methods on the MNIST dataset.

Exam tip: a classic interview question is why fully connected layers cannot efficiently process images. The answer is parameter count. A 224 by 224 colour image has over 150,000 pixels. A fully connected layer connecting all inputs to even 1,000 neurons would have 150 million weights in one layer alone. CNNs share weights across spatial positions via filters, reducing this to a manageable number while still capturing spatial patterns.