Skip to content
BIASED

Convolutional architectures

VGG-style depth, the Inception idea, ResNet and why residuals train, MobileNet-style efficient blocks — backbones for later tasks.

From a layer to a network

The topic Convolution took one layer apart: weights, cost, receptive field. A classifier stacks dozens of them, and how to stack them is a design problem with many answers. This topic follows the answers that shaped the field — each fixing a problem the previous one left.

LeNet-5 (LeCun et al., 1998) already set the pattern on 32×3232 \times 32 digits: convolutions, 2×22 \times 2 downsampling, more channels as the map shrinks, then a dense classifier. Modern reimplementations with full channel connections have about 6262k parameters. Two limits show up early: the dense head fixes the input size, and the last convolution’s receptive field is still small (~14×1414 \times 14).

AlexNet kept the pattern and scaled it to ImageNet: five convolutions (first 11×1111 \times 11, stride 4) and three dense layers, ~60M parameters. In torchvision’s single-tower count, ~96% of the parameters sit in the dense head; the convolutions do most of the FLOPs. ReLU, dropout and augmentation made the scale trainable — see What deep learning is.

VGG: stacks of small kernels

VGG (Simonyan and Zisserman, 2015) asked what depth alone does. Every convolution is 3×33 \times 3 with stride 1 and padding 1; every downsampling is 2×22 \times 2 max pool with stride 2; channels double after each pool, from 64 to 512.

By the receptive-field recursion, nn layers of 3×33 \times 3 at stride 1 see (2n+1)×(2n+1)(2n+1) \times (2n+1). Three such layers match one 7×77 \times 7 in field of view, but cost 27C227 C^2 weights against 49C249 C^2, and apply three nonlinearities instead of one. At C=256C = 256 that is 1,769,4721{,}769{,}472 against 3,211,2643{,}211{,}264.

The price: VGG-16 has 138M parameters (2.3×2.3\times AlexNet; ~89% in the fully connected head) and ~15.3B FLOPs per 224×224224 \times 224 image — about 21×21\times a typical AlexNet count (~0.7B multiply-adds) at the same resolution and counting convention. Parameters and FLOPs are different bases here: the head inflates NN, the convolutions dominate cost. Global average pooling later removed most of that head.

Inception: branches and 1×1

GoogLeNet / Inception (Szegedy et al., 2015) lived under a compute budget: 22 layers, ~12× fewer parameters than AlexNet, ILSVRC-2014 winner at 6.67% top-5 error.

An Inception module runs four branches on the same map — 1×11 \times 1, 3×33 \times 3, 5×55 \times 5 and a pooling branch — and concatenates along channels. A raw 5×55 \times 5 on all input channels would dominate cost, so each expensive branch is preceded by a 1×11 \times 1 reduction (the pointwise convolution of the previous topic).

Worked numbers for inception (3a) on a 28×28×19228 \times 28 \times 192 map: branches to 64, 96→12896\to 128, 16→3216\to 32 and pool→32\to 32 channels give 256 outputs and 163,328163{,}328 weights (~128M multiply-adds). Without the two reductions the middle branches alone would need 374,784374{,}784 weights instead of 144,896144{,}896. GoogLeNet also replaced the dense head by global average pooling and, during training only, attached auxiliary classifiers; later Inception versions found the auxiliaries acted mostly as regularizers once BatchNorm was in place.

ResNet: residuals and degradation

By 2015, BatchNorm and careful init (see Normalization and initialization) kept signals alive in deep plain nets. They still trained poorly. On ImageNet, a 34-layer plain net had higher training error than an 18-layer one throughout training (He et al., 2016). That is the degradation problem: not overfitting (train error is worse too), and not vanishing gradients (norms stayed healthy). The deeper net can represent the shallower one by setting extra layers to identity; the optimizer does not find that.

Key idea: make identity the default. A residual block outputs x+F(x)x + F(x). With small weights, F≈0F \approx 0 and the block passes its input through; each block only learns a correction, and the shortcut carries the gradient past every block through an identity term (as derived in Machine Learning).

The basic block (ResNet-18/34) is two 3×33 \times 3 convolutions with BN and a ReLU between them; add, then ReLU. The bottleneck (ResNet-50+) is 1×1→3×3→1×11 \times 1 \to 3 \times 3 \to 1 \times 1 through a quarter of the channels: at 256 channels, 69,63269{,}632 weights against 1,179,6481{,}179{,}648 for two full-width 3×33 \times 3 layers. When shape changes, a projection 1×11 \times 1 shortcut matches dimensions; elsewhere identity shortcuts stay free. With shortcuts, depth helped again: ResNet-152 undercut VGG-16 in FLOPs and won ILSVRC-2015.

MobileNet and scaling

DenseNet concatenates every earlier map inside a block instead of adding: features are reused, each layer adds only kk new channels (growth rate), and transition layers shrink channels and resolution between blocks. Memory grows with the concatenated maps.

MobileNet (Howard et al., 2017) targets phones. A standard k×kk \times k convolution mixes neighbours and channels at once; a depthwise-separable convolution does them separately: one k×kk \times k filter per input channel (groups=M), then a 1×11 \times 1 mix. The cost ratio is

k2M+MNk2MN=1N+1k2,\frac{k^2 M + M N}{k^2 M N} = \frac{1}{N} + \frac{1}{k^2},

about 1/91/9 for 3×33 \times 3 and large NN. At M=N=512M = N = 512 on 14×1414 \times 14, weights fall from ~2.36M to ~267k. Almost all remaining cost sits in the 1×11 \times 1 layers.

EfficientNet (Tan and Le, 2019) scales depth, width and resolution together: d=αϕd = \alpha^\phi, w=βϕw = \beta^\phi, r=γϕr = \gamma^\phi with αβ2γ2≈2\alpha \beta^2 \gamma^2 \approx 2 so each unit of ϕ\phi roughly doubles FLOPs. With α,β,γ=1.2,1.1,1.15\alpha, \beta, \gamma = 1.2, 1.1, 1.15, ϕ=7\phi = 7 multiplies FLOPs by ~96 and grows a 224224 input toward ~600600 pixels (EfficientNet-B7).

Transfer learning

A network trained on ImageNet splits into a backbone (convolutions up to global pooling) and a head (the final linear classifier). Early layers learn edges and textures that transfer widely; later layers become task-specific (Yosinski et al., 2014).

  • Feature extraction / linear probing. Freeze the backbone, train a new head. Cheap, hard to overfit.
  • Fine-tuning. Train everything from the pretrained weights, usually with a smaller learning rate on the backbone. Better when the new data differ and there are enough of them.

Preprocess exactly as during pretraining (including per-channel normalization). Better ImageNet models tend to transfer better, with caveats on small fine-grained sets (Kornblith, Shlens and Le, 2019). Self-supervised learning later pretrains backbones without labels.

The backbone and the next task

Side-by-side ImageNet numbers from different papers are not a clean ranking: recipes, resolutions and evaluation protocols move accuracy by several points (two ResNet-50 rows in torchvision differ by ~4.7 points at identical architecture). Within one controlled comparison — MobileNet’s standard vs separable convolutions, or plain vs residual at matched width — a gap means something.

Every network in this topic answers one question per image: which class. Most vision uses need more — where each object is, and how many there are. The next topic, Object detection, keeps these backbones and changes the head: from one label to a set of boxes with classes, with the losses and metrics that come with it.

Check your understanding

The same questions as in Pulse. Answers are shared between modes.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Residual vs plain: depth degradationoptional

    NumPy sin-x regression: deep plain ReLU vs residual. Self-check in the notebook.

    ~25 min · easier on a computer · Convolutional architectures topic read.

    Self-check in the notebook — not part of mastery or the certificate.

Full notes

Answers are saved on the server and tied to this browser until you sign in.