Convolutional Neural Networks
Convolutional neural networks (CNNs) encode two useful assumptions for grid-like data:
- locality: nearby values interact before distant values;
- parameter sharing: the same learned detector is applied across positions.
These assumptions reduce parameter count and make the representation translation equivariant: shifting the input tends to shift the resulting feature map. Equivariance is not the same as invariance. Pooling, aggregation, augmentation, and task design may produce some tolerance to shifts, but convolution alone does not make the output unchanged.
Cross-Correlation Layer
Deep-learning libraries usually implement cross-correlation even when the operation is called convolution. For input and kernel ,
The kernel spans all input channels and produces one output channel . Multiple learned kernels create multiple feature maps.
For one spatial dimension, kernel width , padding on each side, and stride , the output length is
The same calculation applies independently to height and width. Dilation adds spacing between kernel elements and changes the effective kernel size.
Building Blocks
- Padding controls border treatment and often preserves spatial size.
- Stride subsamples while applying the kernel.
- Pooling summarizes local neighborhoods without learned spatial weights.
- convolution mixes channels independently at each spatial position.
- Stacked layers increase the receptive field and compose local features into higher-level representations.
Boundaries
- The useful inductive bias depends on the data; locality and translation structure are not universal.
- Downsampling can discard small or precisely located signals.
- A large receptive field does not prove that the model effectively uses all relevant context.
- Accuracy under random crops does not establish robustness to real distribution shift.
- Dataset construction and augmentation choices can dominate architecture changes.
Use a small MLP or linear model as a baseline when the input does not clearly benefit from spatial structure. For maintained implementations and exercises, see Dive into Deep Learning: Convolutional Neural Networks.