# VGG16: small filters in a regular sequence

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/8/tee-c8-s12

Canonical: https://deep-learning-study-room.vercel.app/read/dl/tee/section/tee-c8-s12/

![Follow the five blocks and their output sizes. The 16 counts learned layers, not pooling or flattening.](https://deep-learning-study-room.vercel.app/assets/figures/u4_vgg16.svg)

Diagram: Follow the five blocks and their output sizes. The 16 counts learned layers, not pooling or flattening.. Labels: u4 vgg16 | VGG16: 13 convolution layers + 3 dense layers | Block 1 | 2 convolutions | Block 2 | 2 convolutions | Block 3 | 3 convolutions | Block 4 | 3 convolutions | Block 5 | 3 convolutions | 112 × 112 | 56 × 56 | 28 × 28 | 14 × 14 | 7 × 7 | Sizes shown after each 2 × 2 pool, starting from a 224 × 224 image. | 7 × 7 × 512 → flatten 25,088 → 4,096 → 4,096 → 1,000

Follow the five blocks and their output sizes. The 16 counts learned layers, not pooling or flattening. Tap the diagram to enlarge.

**Definition.** VGG16 is a convolutional architecture with 13 convolutional layers and three dense layers. Its standard convolution blocks contain 2, 2, 3, 3 and 3 convolutions. Pooling, activations and flattening are not counted in the name's 16 weight layers.

Each convolution uses a 3 × 3 kernel, stride 1 and padding 1, preserving height and width. Each block ends with 2 × 2 max pooling of stride 2. The final classifier is 4,096 → 4,096 → 1,000 for the original 1,000-class task.

| Block | Convolutions | Channels after its convolutions | Size after its pooling |
| --- | --- | --- | --- |
| 1 | Two | 64 | 112 × 112 × 64 |
| 2 | Two | 128 | 56 × 56 × 128 |
| 3 | Three | 256 | 28 × 28 × 256 |
| 4 | Three | 512 | 14 × 14 × 512 |
| 5 | Three | 512 | 7 × 7 × 512 |

This table starts with 224 × 224 × 3. The flattened length is 7 × 7 × 512 = 25,088. Flattening has zero learned parameters. Stacking small filters provides repeated nonlinear transformations while progressively combining spatial information. A limitation is the large dense classifier and its memory cost.

**Question (practice, 3 marks). VGG16's first block contains two same-padded 3 × 3 convolutions with 64 output filters each, followed by 2 × 2 max pooling with stride 2. Input is 224 × 224 × 3. Find both convolution parameter counts including bias and the pooled output shape.**

### Given

Conv1: 3 input channels, 64 output channels. Conv2: 64 input channels, 64 output channels. Both have kernel 3, stride 1 and padding 1. Pooling has kernel 2, stride 2 and no padding.

### To find

Trainable parameters in each convolution and the output after pooling.

### Formula — which one and why



$$
P_{\mathrm{conv}}=(K^2C_{\mathrm{in}}+1)C_{\mathrm{out}}
$$



Use each layer's own input depth; the second layer receives the first layer's 64 maps. Use the spatial-output formula for pooling. Max pooling introduces no trainable parameters.

### Solution — step by step

**Step 1: first convolution.** Each filter has 3 × 3 × 3 = 27 weights and one bias.



$$
P_1=(27+1)(64)=1792
$$



**Step 2: second convolution.** Each filter now spans 64 channels, giving 3 × 3 × 64 = 576 weights.



$$
P_2=(576+1)(64)=36928
$$



**Step 3: add parameters.**



$$
P_{\mathrm{block}}=1792+36928=38720
$$



**Step 4: calculate pooled side length.** The same-padded convolutions retained side length 224.



$$
\frac{224-2}{2}+1=111+1=112
$$



**Final answer:** 1,792 and 36,928 parameters; total = 38,720; pooled shape = **112 × 112 × 64**.

**Exam convention:** use the architecture explicitly supplied in a calculation. For the standard VGG16 architecture, remember **2–2–3–3–3 convolutions and 2 × 2 pooling**; 25,088 is the flattened feature length.
