A Convolutional Neural Network (CNN) is a deep learning architecture inspired by the visual cortex: instead of examining each pixel in isolation, it slides small filters across an image to detect local patterns — edges, textures, then increasingly abstract shapes. It is the architecture that ushered computer vision into the modern era.
How it works
At the heart of a CNN lies the convolution operation: a filter (or kernel) sweeps across the image and computes a local dot product at each position. For an input $I$ and kernel $K$:
$$ (I * K)(i,j) = \sum_{m}\sum_{n} I(i+m,\, j+n)\, K(m,n) $$
Three key ideas make the architecture efficient:
- Weight sharing: the same filter is applied everywhere, drastically reducing the number of parameters.
- Locality: each neuron looks only at a small region (its receptive field).
- Translation invariance: a pattern is recognized regardless of its position.
The typical layers
| Layer | Role |
|---|---|
| Convolution | Extract patterns via filters |
| Activation (ReLU) | Introduce non-linearity |
| Pooling | Downsample, gain robustness |
| Fully connected | Combine features to decide |
By stacking these layers, the network learns a hierarchy: early layers detect edges, deeper layers detect whole objects (a face, a car).
What it is used for
CNNs dominate image classification, object detection, medical imaging, and face recognition. They also inspired more recent architectures.
The CNN taught machines to view an image as a structured whole, not as a grid of numbers.