Exercises — VGG networks
This page is a self-test ladder. Each rung is harder than the last. Cover the answer, try the problem, then open the solution. Every symbol used here is built in the parent VGG networks note — if a formula feels unfamiliar, re-read that note first.
Three tools we lean on repeatedly (all from the parent):
Here are the kernel's height and width in pixels; are the number of input and output channels (feature maps); means "round down to the nearest whole number" (you cannot have half a pixel of output).
Related notes you may want open: 3.4.01-convolution-operation, 3.4.05-alexnet, 3.6.03-receptive-field, 3.5.02-batch-normalization, 3.4.08-resnet, 3.4.15-transfer-learning.
Level 1 — Recognition
Exercise 1.1
State VGG's five design rules in one line each (no derivations).
Recall Solution
- Only 3×3 convolutions everywhere.
- Same padding so spatial size is preserved until a pooling layer.
- Max-pool 2×2, stride 2 to halve height and width.
- Double the channel count after each pooling stage.
- Deep uniform stacks (VGG-16 = 16 weight layers, VGG-19 = 19).
Exercise 1.2
The canonical VGG-16 uses which kernel sizes for its convolution layers? Pick all that apply: 1×1, 3×3, 5×5, 7×7, 11×11.
Recall Solution
Only 3×3. The famous VGG-16/19 use no 1×1, 5×5, 7×7, or 11×11 conv layers. (The paper's experimental "configuration C" added 1×1 convs, but that is not the canonical VGG-16.)
Exercise 1.3
VGG-16 has ~138M parameters. In which part of the network do most of them live — the convolution stack or the fully-connected classifier?
Recall Solution
The fully-connected (FC) classifier. The first FC layer alone maps flattened inputs to 4096 outputs, giving M parameters — already about three-quarters of the whole network.
Level 2 — Application
Exercise 2.1
Compute the parameter count (weights and biases) of a Conv3-128 layer whose input has 64 channels.
Recall Solution
Use with , , . Why this formula: each of the 128 output filters carries a full weight tensor (one weight per input pixel per input channel) plus a single bias — hence the "".
Exercise 2.2
An input feature map is . Apply a 3×3 conv with same-padding , stride . What is the output height?
Recall Solution
Same padding with keeps the spatial size unchanged — the whole point of "same" padding. Only pooling shrinks the map.
Exercise 2.3
Track the spatial size (height only) of a 224×224 input through Block 1 of VGG-16: two Conv3 layers (same padding), then MaxPool2 (2×2, stride 2, no padding).
Recall Solution
Conv 1: . Conv 2: . MaxPool2: here : . So . The convs preserve, the pool halves. See the figure below.

Level 3 — Analysis
Exercise 3.1
Prove that two stacked 3×3 convolutions (stride 1) have the same receptive field as one 5×5, using the RF recurrence.
Recall Solution
Start with (the first layer sees a 3×3 patch of the input). Apply the recurrence for layer 2, where and the only earlier stride is : So two 3×3 layers reach a 5×5 window of the original image — identical to one 5×5 conv. The figure shows how the second layer's central output pixel traces back to a 5×5 input region.

Exercise 3.2
Compare parameters (weights only, channels in and out throughout): one 5×5 conv versus two 3×3 convs. Report the percentage saved.
Recall Solution
One 5×5: . Two 3×3: . Saving: fewer weights. Bonus: two 3×3 layers pass through two ReLU non-linearities instead of one — more expressive decision boundaries for less cost.
Exercise 3.3
Now extend to three 3×3 convs (stride 1). Find the receptive field, and the percentage of weights saved versus one 7×7 conv (→).
Recall Solution
Receptive field: build up layer by layer. ; ; . So three 3×3 = a 7×7 window. Weights: three 3×3 give ; one 7×7 gives . Saving: (the parent note rounds this to "45%"). Plus three ReLUs instead of one.
Level 4 — Synthesis
Exercise 4.1
Design a "mini-VGG" Block 3 that turns a 56×56×128 map into 28×28×256, and compute its total parameters (weights + biases). Use three Conv3-256 layers (same padding) followed by MaxPool2.
Recall Solution
The three conv layers each output 256 channels; only the first has 128 input channels, the next two have 256 input channels.
- Conv3-256 (128→256): .
- Conv3-256 (256→256): .
- Conv3-256 (256→256): another .
- MaxPool2: 0 parameters (it just picks the max — no learnable weights). Total parameters. Spatial size: (convs preserve) then (pool halves).
Exercise 4.2
Compute the activation memory (float32) of the output of a single Conv3-256 layer on a 56×56 map, for one image and for a batch of 32.
Recall Solution
One activation tensor is floats. Each float32 = 4 bytes. In decimal MB ( bytes) this is MB — the value the parent quotes. For a batch of 32: bytes MB (binary) or MB (decimal). Roughly ~100 MB for one layer's activations alone — this is why deep nets are memory-hungry during training (you must store activations for backprop).
Level 5 — Mastery
Exercise 5.1
A team replaces VGG's Block 5 (three Conv3-512 layers, all 512→512) with a single Conv-512 whose receptive field equals the three stacked 3×3s. (a) What kernel size must the single conv have? (b) Compute weights-only parameters for both designs and the percentage the single-conv design adds. (c) Give one non-parameter reason the stacked design is still preferable.
Recall Solution
(a) Three stride-1 3×3 convs reach (Exercise 3.3), so the single conv needs a 7×7 kernel. (b) With :
- Stacked (weights only): .
- Single 7×7: .
- The single conv uses more weights.
- (Equivalently, the stacked design saves versus the single 7×7.) (c) The stacked design applies three ReLU non-linearities instead of one, giving a more expressive, more non-linear function for the same-sized receptive field — the extra decision boundaries are exactly VGG's core argument for going deep with small filters.
Exercise 5.2
The full receptive field of a VGG feature-map pixel (not the raw kernel math) is boosted by pooling too. Using the general recurrence, compute the receptive field after: Conv3 → Conv3 → MaxPool2(s=2) → Conv3. Treat max-pool like a layer with stride 2, and note the strides before each layer.
Recall Solution
Layers in order (kernel , stride ): L1 (3,1), L2 (3,1), L3 pool (2,2), L4 (3,1). Track the running product of strides of layers before the current one.
- . Strides so far: .
- . Strides: .
- . Strides now include : .
- . So one pixel after this stack sees a 10×10 region of the input. The pool's stride of 2 magnifies the reach of every later layer — that is why deep VGG pixels "see" almost the whole image.
Recall One-line self-check summary
Conv weights ::: , bias per output channel Same-pad 3×3 output size ::: unchanged (only pooling halves it) Two/three 3×3 receptive field ::: 5×5 / 7×7 Weights saved: two 3×3 vs 5×5 ::: 28% Weights saved: three 3×3 vs 7×7 ::: ~45% Where 138M params live ::: mostly in the first FC layer (~103M)