TL;DR
A convolutional neural network processes data that has a grid structure, such as images, by sliding the same small filter across every position and feeding the results into further layers. Because the filter's weights are shared across positions, the network detects a pattern wherever it appears and needs far fewer parameters than a network whose every input connects to every neuron. Stacked layers build from edges to textures to object parts.
Where you'll see it: in image classification, object detection and segmentation, medical scans, and audio models that treat a spectrogram as an image.
Intuition
A fully connected network does not know about neighbours
Suppose you feed a grey image into a Feedforward Neural Network by flattening it into 784 numbers. Every neuron in the first layer is connected to all 784 pixels, with its own weight for each. The network has no built-in idea that nearby pixels are related. A vertical edge in the top-left corner and the same edge in the bottom-right corner are two unrelated sets of weights that must each be learned from examples. Move the object a few pixels and the network sees a different input.
A convolutional network fixes both problems with two ideas. The first is local connectivity: each neuron looks only at a small patch, say pixels. The second is weight sharing: the same weights are used for every patch. One filter that detects a vertical edge is therefore applied across the whole image. It finds the edge wherever it is. This is what people mean by translation equivariance: shift the input, and the output shifts by the same amount.
One filter, many positions
Think of a small window passed over a photograph. At each position it asks "does the patch here look like a vertical edge?" and writes down a score. The result is a new grid of scores, one per position, called a feature map. A layer usually has many filters, each producing its own feature map, and each filter learns to look for a different pattern.
flowchart LR A[Input image] --> B[Convolution + ReLU] B --> C[Max pooling] C --> D[Convolution + ReLU] D --> E[Max pooling] E --> F[Flatten] F --> G[Dense layer] G --> H[Softmax over classes]
Early layers respond to edges and colour blobs. Deeper layers combine these into textures, then parts such as eyes or wheels, then whole objects. Pooling between layers shrinks the grid, so later filters cover a larger part of the original image. That growth in coverage is what lets a deep network recognise large objects using only small local filters.
The math
Discrete convolution as used in networks
Let the input be a grid with height , width , and channels. A filter, or kernel, is a block of weights with size and a bias . The output at position is
This is a weighted sum of the patch under the filter. Here is the position of the output, index the rows and columns of the filter, and indexes the input channels. Each output position uses the same and .
The mathematical definition in Convolution flips the kernel before sliding it. Deep learning libraries skip the flip and compute what is properly called cross-correlation. The difference does not matter in practice, because the network learns whatever weights it needs, and a flipped kernel is just another kernel.
Each filter produces one output channel. With filters, the layer's output has channels, and its parameter count is
This count does not depend on the size of the image. That is the point of weight sharing.
Output size
With stride (how far the window moves each step) and padding (zeros added around the border), the output width along one side is
The same formula applies to height. Padding of with stride 1 keeps the size unchanged for odd .
Nonlinearity and pooling
After each convolution, an activation such as Rectified Linear Unit (ReLU) is applied entry by entry. Without it, a stack of convolutions would collapse into a single convolution, because the composition of linear maps is linear. Pooling then reduces the grid size. Max pooling with a window and stride 2 takes the largest value in each non-overlapping block, halving the height and width. See Max Pooling for the details.
Classification head
After the final convolutional stage, the feature maps are flattened into a vector and passed through one or more dense layers. The last layer produces one score per class, and Softmax turns the scores into probabilities. Training minimises the Cross-Entropy Loss.
Gradients for a shared filter
Backpropagation through a convolution follows the same chain rule as in Backpropagation, with one new feature. A single kernel weight is used at every output position, so its total gradient is the sum of its contributions from all positions:
This is the rule for any weight that is used more than once. Its gradients add up across the uses. The gradient with respect to the input is a transposed convolution of the output gradient with the same kernel, which is why Transposed Convolution appears in networks that upsample.
Worked examples
Take the input sequence and the kernel . The kernel has size , stride 1, and no padding. The output length is .
- Position 0 covers . The sum is .
- Position 1 covers . The sum is .
- Position 2 covers . The sum is .
The output is . At each position the kernel subtracts the last entry of the window from the first, so it responds to change across the window. The first output is because the input rises from 1 to 3 across that window, and the last two outputs are because the first entry of each of those windows is larger than the last (2 against 0, then 3 against 1). A sharp change in a one-dimensional signal is called an edge, and this filter's output is large in size where one occurs.
Interpretation: a tiny, fixed set of three numbers produces a useful response at every position. A network learns the three numbers from data instead of having them written by hand.
Consider an RGB image of size . The first convolutional layer uses 64 filters of size , with stride 1 and padding 1, so the output keeps its size and has 64 channels.
Parameters in the convolution. Each filter has weights and one bias, so the layer has
parameters.
Parameters in a fully connected layer of the same shape. The input has values. The output has values. A dense layer between them needs one weight per input-output pair:
Comparison. The convolution uses about 1,800 parameters where a dense layer would use roughly . The convolution also has the translation property, which the dense layer lacks.
Interpretation: the gap is so large that dense layers are not used on raw images at this scale. Convolution is what makes image models feasible.
Tradeoffs and failure modes
Convolutional networks are strong when the data has local structure and the important patterns can appear anywhere. They are weaker when the relationships are global or the positions carry meaning.
| Situation | Problem | Better choice |
|---|---|---|
| Patterns depend on absolute position, such as a face's eyes being at the top | Shared filters ignore position unless the network is told | Add coordinate channels, or use position encodings |
| Very small training set | A large model still overfits, even with sharing | Data augmentation, pretrained weights, or fewer filters |
| Long-range dependencies, such as a sentence or a video where events are far apart | Local filters need many layers to connect distant positions | Transformer or Vision Transformer (ViT) with global attention |
| Dense per-pixel output, such as segmentation | Pooling discards resolution | Encoder-decoder designs like U-Net with skip connections |
| Deep stacks of layers | Gradients can vanish, and training stalls | [[residual-connection |
| Input sizes that change between examples | Dense layers at the end need a fixed size | Global average pooling before the classifier |
Convolutional networks also need care with padding and stride. A stride that does not divide the input size evenly can make the output grid awkward to align, and a poorly chosen padding can shift features by a pixel in each layer.
History
Kunihiko Fukushima described the Neocognitron in 1980. It was a multilayer network with local receptive fields inspired by the visual cortex, trained with a layer-wise learning rule rather than backpropagation.
Yann LeCun and colleagues combined convolution with backpropagation in the late 1980s. A 1989 paper applied this to recognising handwritten zip codes. Their later network, LeNet-5, was published in 1998 and read cheques in banks. It showed that the design worked on a real task, although it was limited by the computing power of its time.
The field changed in 2012. Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton trained a deep convolutional network, later named AlexNet, on the ImageNet dataset using graphics processors. It won the ImageNet competition by a wide margin, and deep convolutional networks became the standard approach to vision. The combination of large datasets, GPUs, and the ideas from LeCun's group made the difference.
Check yourself
QuestionRecall: what are the two main ideas that give a convolutional network fewer parameters than a fully connected one?Show answer
Local connectivity, where each neuron looks only at a small patch of the input, and weight sharing, where the same filter weights are used at every position. Together they mean the parameter count depends on the filter size and the number of filters, not on the image size.
QuestionComputation: a layer has 32 filters of size applied to an input with 3 channels. How many parameters does it have, including biases?Show answer
Each filter has weights and one bias, so 76 parameters per filter. With 32 filters the total is .
QuestionWhy: why does the network need a nonlinearity such as ReLU between convolutions?Show answer
Convolution is a linear operation, and a composition of linear operations is itself linear. Without a nonlinearity, a stack of convolutional layers would be equivalent to one convolution, which cannot represent the complex functions needed for recognition. The ReLU after each convolution lets each layer combine features in a way that a single layer cannot.
QuestionApplied: a network for satellite images must classify whether a road crosses the centre of each tile, and the road can be anywhere in the tile. Would you use a convolutional network, and what would you check?Show answer
Yes. Roads are local structures that appear at different positions, which is exactly what weight sharing exploits. I would check that the receptive field after the final layer is large enough to see a whole road segment, since a road that spans much of a tile needs more than small filters can see. I would also check that pooling does not remove the thin road signal, and I would confirm that the labels really mean "a road crosses the centre" rather than "a road appears somewhere in the tile", because those are different tasks.
Sources
- Goodfellow, Bengio, Courville, Deep Learning, Chapter 9: https://www.deeplearningbook.org/
- Convolutional neural network (Wikipedia)
- LeNet (Wikipedia)
- Krizhevsky, Sutskever, Hinton, ImageNet Classification with Deep Convolutional Neural Networks, 2012: https://papers.nips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html