Convolutional Neural Networks
CNNs exploit the spatial structure of images by sharing small filters across a grid, learning local patterns that compose into global understanding.
The idea
A convolutional neural network replaces the dense connections of an MLP with small filters that slide across a spatial grid. Each filter looks at a local patch, and the same filter weights are reused at every position. This weight sharing encodes a prior that a useful pattern, an edge or a texture, is useful wherever it appears. The result is far fewer parameters than a fully connected layer over the same image.
Two key properties
- Local connectivity: each output depends only on a small input patch (its receptive field).
- Translation equivariance: shifting the input shifts the feature map by the same amount, so the network need not relearn a pattern at every location.
Hierarchical features
Stacking convolutional layers builds a hierarchy. Early layers detect edges and simple gradients. Middle layers combine those into corners, textures, and motifs. Deep layers respond to object parts and whole objects. As depth increases the effective receptive field grows, so late neurons integrate information from a large region of the original image even though each filter is small.
Anatomy of a block
A typical block is convolution, then a normalization such as batch norm, then a nonlinearity such as ReLU, often followed by pooling or a strided convolution that reduces spatial resolution while increasing the number of channels. Channels act as a bank of feature detectors; downsampling trades spatial detail for semantic abstraction as you go deeper.
import torch.nn as nn
block = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.MaxPool2d(2)) # halves height and width
Where CNNs are used
CNNs dominate image classification, object detection, and segmentation, and they extend to any grid-structured signal: audio spectrograms, video, and volumetric scans. In fusion and plasma research, convolutional models process diagnostic camera frames and 2D field maps to flag instabilities or reconstruct plasma shape from sensor images. The same locality prior that suits photographs suits any signal where nearby measurements are related.
- Shared filters slide across a grid, cutting parameters sharply.
- Local connectivity plus translation equivariance are the core priors.
- Depth builds edges to textures to objects.
- Applies to any grid signal, not only photographs.