Neural Mastery

Convolutional Neural Networks (CNNs)

Before Transformers took over vision too, CNNs were — and largely still are — the default architecture for image data, because they bake in an assumption that fits images perfectly: nearby pixels are related, and patterns are useful no matter where they appear in the image.

Convolution and Pooling

A convolution slides a small learnable filter (e.g. 3×3) across the image, computing a weighted sum at each position — detecting local patterns like edges or textures. Because the same filter is reused across the whole image, CNNs need far fewer parameters than a fully-connected layer would for the same input size, and they naturally handle patterns regardless of where they appear in the image ("translation invariance").

5×5 input
1230101231101202101102102
filter positions (click)
output[1][1] = -4
Output at (1,1) = sum of elementwise products between the filter and this 3×3 patch = -4. The SAME filter weights are reused at every position -- far fewer parameters than a fully-connected layer over the whole image.

Pooling (typically max-pooling) downsamples the feature map, keeping the strongest activation in each local region — reduces spatial size and adds a small amount of positional robustness.

1320421101321204
Max of this 2×2 region = 4 -- the strongest activation survives, the other three are discarded. Output shrinks from 4×4 to 2×2, and small shifts within a region don't change which value wins (a bit of positional robustness).

Receptive field: how much of the original image a given neuron "sees," which grows as you stack more convolutional layers — deeper layers see larger, more abstract patterns (edges → textures → parts → objects).

1 layer
2 layers
3 layers
4 layers
After 2 layers of stacked 3×3 convolutions, one output neuron "sees" a 5×5 patch of the original image -- deeper layers see larger, more abstract patterns (edges → textures).

The Architecture Lineage

1998
LeNet
2012
AlexNet
2013
ZFNet
2014
VGGNet
2014
GoogLeNet/Inception
2015
ResNet
2016
DenseNet
2017
MobileNet
2019
EfficientNet
2022
ConvNeXt
Residual/skip connections solve the degradation problem -- enabled networks over 100 layers deep for the first time.
  • LeNet (1998) — the original proof-of-concept CNN, for digit recognition; two conv/pool stages feeding two fully-connected layers, tiny by modern standards but the template everything below descends from.
  • AlexNet (2012) — the breakthrough that kicked off the deep learning boom: a deeper CNN trained on GPUs at ImageNet scale, using ReLU (faster convergence than sigmoid/tanh), dropout, and data augmentation to control overfitting.
  • ZFNet (2013) — mostly a tuned AlexNet with smaller first-layer filters and a stride reduction, notable for pairing the architecture with deconvolution-based visualizations that made it possible to actually see what early CNN filters were learning.
  • VGGNet (2014) — replaced AlexNet's large filters with a deep stack of uniform 3×3 convolutions, showing that depth built from small, simple filters (two 3×3 layers have the same receptive field as one 5×5 layer, with fewer parameters and an extra nonlinearity) outperforms shallower networks with larger filters.
  • GoogLeNet / Inception (2014) — introduced the Inception module: run several filter sizes (1×1, 3×3, 5×5) and a pooling branch in parallel at each stage and concatenate their outputs, letting the network pick the useful scale rather than committing to one; 1×1 convolutions are used as cheap dimensionality reduction before the expensive larger filters.
input feature map
1×1 conv
3×3 conv
5×5 conv
3×3 max-pool
concatenated output
Cheap dimensionality reduction -- mixes channels without looking at neighbors, used before the expensive larger filters too.
  • ResNet (2015) — introduced residual/skip connections (see Training Deep Networks): each block learns a residual F(x) added back to its input, y = F(x) + x, so a block can default to the identity function if depth isn't helping. This solved the degradation problem (very deep plain networks got worse, not just harder to train) and enabled networks over 100 layers deep for the first time.
x (input)F(x)y = F(x) + x
If F(x) learns to output ~0, the block just passes x through unchanged -- depth can never make things WORSE than a shallower network, because every added block can fall back to identity.
  • DenseNet (2016) — pushes the skip-connection idea further: every layer receives the concatenated feature maps of all preceding layers, not just the previous one — maximizes feature reuse and gradient flow, at the cost of higher memory usage from all those concatenations.
  • MobileNet (2017) — built for phones/edge devices using depthwise separable convolutions: a standard convolution is factored into a depthwise convolution (one filter per input channel, spatial-only) followed by a 1×1 pointwise convolution (mixes channels) — roughly the same representational power at a fraction of the multiply-adds.
Depthwise
1 filter/channel, spatial only — 3.6M
Pointwise (1×1)
mixes channels — 25.7M
total: 29.3M multiply-adds
Depthwise (one filter per input channel, spatial only) + 1×1 pointwise (mixes channels) = 29.3M multiply-adds -- roughly 7.9× cheaper than standard, at close to the same representational power.
  • EfficientNet (2019) — systematically scales depth, width, and input resolution together via compound scaling (a single coefficient balances all three, rather than arbitrarily increasing one) for the best accuracy-per-FLOP tradeoff of the classic CNN lineage.
  • ConvNeXt (2022) — takes a plain ResNet and modernizes it with design choices borrowed from Vision Transformers (larger kernel sizes, fewer activation functions, LayerNorm instead of BatchNorm, an inverted bottleneck) — shows a "pure" CNN can match ViT-era accuracy without attention at all, once trained with modern recipes.

Applications

  • Image classification: assign a single label to an image.
  • Object detection: locate and classify multiple objects within an image (bounding boxes) — see Vision Architectures for the R-CNN/YOLO/SSD lineage built for this specifically.
  • Segmentation: classify every pixel — used in medical imaging, autonomous driving; see Vision Architectures for U-Net, Mask R-CNN, and the segmentation-specific model families.
Classification
Object Detection
Segmentation
Locate AND classify multiple objects with bounding boxes -- the R-CNN/YOLO/SSD lineage is built for this specifically.

Why Vision Moved Toward Transformers Too

CNNs' locality assumption is also a limitation — capturing long-range relationships between distant parts of an image requires many stacked layers. Vision Transformers (covered in depth in Vision Architectures) instead split an image into patches and apply self-attention across all of them directly, letting any patch attend to any other patch from the very first layer. In practice, ViTs need more data to train well than CNNs (they lack CNNs' built-in locality bias), but they now match or beat CNNs at scale.

A Vision Transformer splits the image into patches and applies self-attention across ALL of them -- any patch attends to any other patch from layer 1. Needs more data to train well (no built-in locality bias), but matches or beats CNNs at scale.

Next: Sequence Models — the architectures built for data where order matters: text, time series, audio.

Last updated Sep 5, 2026Edit this pageReport an issue
← Previous
Training Deep Networks
Next →
Sequence Models