Convolutional Neural Networks
How alternating convolution and pooling layers form a pipeline that shrinks spatial dimensions while deepening feature representations.
Images are grids, and a pixel's meaning comes entirely from its neighbors. Flattening that grid into a vector to feed a standard neural network destroys those proximity relationships, forcing the network to learn spatial structure from scratch without the geometry to help it.
Preserving Structure
Instead of flattening, a convolutional layer scans a small window across the image. It computes a local feature for each patch and outputs a new 2D grid. The spatial relationship between top-left and bottom-right is preserved, but now the grid holds extracted features rather than raw colors.
Shrinking the Map
A pooling layer follows the convolution. It takes a local neighborhood — usually a 2×2 block — and passes only the maximum value forward. This shrinks the spatial dimensions by half and makes the network slightly invariant to exactly where a feature appeared in the original input.
The Deep Pipeline
A Convolutional Neural Network (CNN) stacks these blocks in sequence. As the data flows deeper, repeated pooling shrinks the width and height, while repeated convolutions increase the channel depth. The network systematically trades spatial resolution — "where exactly is it?" — for feature richness — "what exactly is it?". Only at the very end is the small, deep volume flattened into a vector for classification.
Feature Hierarchy
This shape forces a natural division of labor. Early layers, looking at small local patches of the original pixels, learn to detect simple edges and corners. Middle layers combine those edges into textures and simple parts. Deep layers, reading the composite output, respond to complete, complex objects specific to the dataset.
Where It Breaks
The architecture fails if downsampling outpaces feature extraction. If a small input image is pooled too many times, the spatial dimensions collapse to a single pixel before the network has built enough depth to represent the data. The structure is destroyed prematurely, and the model cannot learn.
The Quick Version
- Flattening images destroys their inherent 2D spatial relationships.
- Convolution preserves geometry by scanning local patches into feature maps.
- Pooling shrinks the maps, saving compute and adding positional tolerance.
- The pipeline systematically trades spatial resolution for feature depth.
- The network naturally learns a hierarchy from simple edges to complex shapes.
- Extreme downsampling on small inputs destroys structure before features form.