CNN Architectures
🎯 Learning Objectives
- Trace the historical evolution of CNN architectures from LeNet-5 to EfficientNet
- Understand the key innovation behind each architecture
- Count parameters in convolutional and fully-connected layers
- Calculate receptive fields across stacked convolutional layers
- Explain residual connections and why they solve the vanishing gradient problem
- Compare architectures by depth, parameter count, and accuracy
1. Evolution of CNN Architectures
CNN architectures have evolved rapidly since the late 1990s. The major trend has been increasing depth while adding architectural innovations to make deeper networks trainable. ImageNet Large-Scale Visual Recognition Challenge (ILSVRC) results drove much of this progress.
2. Parameter Counting
Params = Cout × (Cin × k × k + 1)
The +1 accounts for the bias term per filter.
Params = nout × (nin + 1)
Example — Parameter Count
Conv layer: 64 filters, 3×3 kernel, 3 input channels:
Params = 64 × (3 × 3 × 3 + 1) = 64 × 28 = 1,792
FC layer: 4096 inputs, 1000 outputs:
Params = 1000 × (4096 + 1) = 4,097,000
3. Receptive Field Calculation
rl−1 = rl + (kl − 1) × ∏j=1l−1 sj
With rL = 1 at the deepest layer. For a simpler sequential stack with all strides = 1:
RF = 1 + ∑l (kl − 1)
Example — Three stacked 3×3 conv layers (stride 1)
RF = 1 + (3−1) + (3−1) + (3−1) = 1 + 2 + 2 + 2 = 7
Three 3×3 layers have the same receptive field as one 7×7 layer but with far fewer parameters: 3 × (C × 3 × 3 × C) = 27C² vs 1 × (C × 7 × 7 × C) = 49C².
4. LeNet-5 (1998)
Designed by Yann LeCun for handwritten digit recognition (MNIST). One of the first successful CNNs.
| Layer | Config | Output | Params |
|---|---|---|---|
| Input | — | 32 × 32 × 1 | — |
| Conv1 | 6 filters, 5×5 | 28 × 28 × 6 | 156 |
| AvgPool1 | 2×2, stride 2 | 14 × 14 × 6 | 0 |
| Conv2 | 16 filters, 5×5 | 10 × 10 × 16 | 2,416 |
| AvgPool2 | 2×2, stride 2 | 5 × 5 × 16 | 0 |
| FC1 | 120 neurons | 120 | 48,120 |
| FC2 | 84 neurons | 84 | 10,164 |
| Output | 10 neurons | 10 | 850 |
Total: ~61,706 parameters. Key features: used average pooling and tanh/sigmoid activations (ReLU was not yet popular).
5. AlexNet (2012)
Won ILSVRC 2012 with a dramatic drop in top-5 error (26.2% → 15.3%). Launched the deep learning revolution in computer vision.
- ReLU activation instead of sigmoid/tanh — faster training, reduces vanishing gradients
- Dropout (p = 0.5) in FC layers for regularisation
- Data augmentation (random crops, horizontal flips, colour jitter)
- Trained on 2 GPUs with model parallelism
- Local Response Normalisation (LRN) — later superseded by Batch Norm
Architecture: 5 conv layers + 3 FC layers. Input: 227 × 227 × 3. ~60 million parameters. Most parameters are in FC layers (FC6 alone has ≈ 37M parameters).
6. VGGNet (2014)
Key idea: use only 3 × 3 convolutions stacked deeply. Simple, uniform architecture.
| Block | VGG-16 Layers | VGG-19 Layers | Filters | Output |
|---|---|---|---|---|
| Block 1 | 2 × Conv3-64 | 2 × Conv3-64 | 64 | 112 × 112 |
| Block 2 | 2 × Conv3-128 | 2 × Conv3-128 | 128 | 56 × 56 |
| Block 3 | 3 × Conv3-256 | 4 × Conv3-256 | 256 | 28 × 28 |
| Block 4 | 3 × Conv3-512 | 4 × Conv3-512 | 512 | 14 × 14 |
| Block 5 | 3 × Conv3-512 | 4 × Conv3-512 | 512 | 7 × 7 |
| FC layers | FC-4096, FC-4096, FC-1000 | — | 1000 | |
VGG-16: ~138M parameters. VGG-19: ~144M parameters. Most parameters still in FC layers.
7. GoogLeNet / Inception (2014)
Won ILSVRC 2014. Introduced the Inception module — parallel branches with different filter sizes concatenated together.
- 1 × 1 convolution
- 1 × 1 conv → 3 × 3 conv
- 1 × 1 conv → 5 × 5 conv
- 3 × 3 max pool → 1 × 1 conv
Example — 1×1 Convolution as Bottleneck
Input: 28 × 28 × 192. Apply 5×5 conv with 32 filters directly:
Params = 32 × (192 × 5 × 5 + 1) = 153,632
With bottleneck: 1×1 conv to 16 channels, then 5×5 conv with 32 filters:
Params = 16 × (192 + 1) + 32 × (16 × 25 + 1) = 3,088 + 12,832 = 15,920
Reduction: ~10× fewer parameters!
GoogLeNet: 22 layers deep, only ~5M parameters (27× fewer than AlexNet). Uses Global Average Pooling instead of FC layers at the end, drastically reducing parameter count. Also uses auxiliary classifiers during training to combat vanishing gradients.
8. ResNet (2015)
Won ILSVRC 2015. Key breakthrough: residual connections (skip connections) that enable training of extremely deep networks (up to 152+ layers).
y = F(x) + x
The identity shortcut x is added to the output of stacked layers. If the optimal mapping is close to identity, it is easier to learn F(x) ≈ 0 than to learn H(x) ≈ x.
Bottleneck Block (ResNet-50+)
For deeper variants, a bottleneck design is used: 1×1 conv (reduce channels) → 3×3 conv → 1×1 conv (expand channels). This reduces computation while maintaining capacity.
| Model | Layers | Block Type | Params | Top-5 Error |
|---|---|---|---|---|
| ResNet-18 | 18 | Basic (2-layer) | 11.7M | 10.92% |
| ResNet-34 | 34 | Basic (2-layer) | 21.8M | 10.15% |
| ResNet-50 | 50 | Bottleneck (3-layer) | 25.6M | 7.71% |
| ResNet-101 | 101 | Bottleneck (3-layer) | 44.5M | 7.10% |
| ResNet-152 | 152 | Bottleneck (3-layer) | 60.2M | 6.71% |
9. DenseNet (2017)
Takes skip connections to the extreme: every layer is connected to every subsequent layer within a dense block.
Advantages: Feature reuse, stronger gradient flow, fewer parameters than ResNet for similar accuracy. Transition layers (1×1 conv + 2×2 avg pool) between dense blocks reduce spatial dimensions and channel count.
10. MobileNet (2017)
Designed for mobile and embedded devices. Uses depthwise separable convolutions to dramatically reduce computation.
- Depthwise convolution: One k × k filter per input channel — spatial filtering only. Params = Cin × k × k.
- Pointwise convolution: 1 × 1 conv to combine channels. Params = Cin × Cout.
Example — Computation Saving
Standard conv: Cin = 64, Cout = 128, k = 3.
Standard params = 128 × 64 × 3 × 3 = 73,728
Depthwise separable params = 64 × 9 + 64 × 128 = 576 + 8,192 = 8,768
Reduction factor ≈ 73,728 / 8,768 ≈ 8.4×
General reduction: 1/Cout + 1/k² ≈ 1/k² for large Cout (about 8–9× for 3×3 kernels).
11. EfficientNet (2019)
Uses compound scaling to uniformly scale network depth, width, and resolution with a fixed ratio.
Depth: d = αφ, Width: w = βφ, Resolution: r = γφ
Subject to α · β² · γ² ≈ 2 (to roughly double FLOPs). The base EfficientNet-B0 uses neural architecture search (NAS) for the baseline architecture.
EfficientNet-B7 achieves state-of-the-art accuracy on ImageNet (84.3% top-1) with 8.4× fewer parameters than the best GPipe model at the time.
12. Architecture Comparison
| Architecture | Year | Depth | Params | Key Innovation | Top-5 Err. |
|---|---|---|---|---|---|
| LeNet-5 | 1998 | 7 | ~60K | First practical CNN | N/A (MNIST) |
| AlexNet | 2012 | 8 | ~60M | ReLU, Dropout, GPU training | 15.3% |
| VGG-16 | 2014 | 16 | 138M | Uniform 3×3 filters | 7.3% |
| GoogLeNet | 2014 | 22 | 5M | Inception module, GAP | 6.7% |
| ResNet-50 | 2015 | 50 | 25.6M | Skip connections | 7.7% |
| ResNet-152 | 2015 | 152 | 60.2M | Deep residual learning | 6.7% |
| DenseNet-121 | 2017 | 121 | 8M | Dense connectivity | ~7.0% |
| MobileNet-v1 | 2017 | 28 | 4.2M | Depthwise separable conv | ~10.5% |
| EfficientNet-B0 | 2019 | — | 5.3M | Compound scaling + NAS | ~6.4% |
13. Summary
- LeNet-5 pioneered CNNs for digit recognition.
- AlexNet proved deep CNNs could win large-scale competitions with ReLU, Dropout, and GPU acceleration.
- VGGNet showed that depth with small 3×3 filters outperforms shallow networks with large filters.
- GoogLeNet introduced Inception modules and 1×1 bottleneck convolutions to reduce parameters.
- ResNet solved the degradation problem with skip connections, enabling 100+ layer networks.
- DenseNet maximises feature reuse with dense connectivity within blocks.
- MobileNet uses depthwise separable convolutions for mobile deployment.
- EfficientNet balances depth, width, and resolution via compound scaling.
- Parameter counting: Conv params = Cout × (Cin × k² + 1); FC params = nout × (nin + 1).
- Receptive field (all strides 1): RF = 1 + ∑(kl − 1).