3.4.7 · D1Convolutional Neural Networks

Foundations — VGG networks

1,963 words9 min readBack to topic

Before you can read the parent note on VGG networks, you need to be fluent in a handful of symbols and pictures. This page builds each one from absolutely nothing. We never use a symbol before we have drawn it.


1. What is an image, to a computer?

A photo on a screen is a grid of numbers. Each little square (a pixel) holds a brightness value. A colour image holds three such grids stacked behind each other — one for Red, one for Green, one for Blue.

Figure — VGG networks

Why the topic needs this: every single number the parent note computes — "224×224×64", "25,088 units", memory in MB — is just counting the boxes in one of these stacked grids. If you can picture the box-stack, you can picture every activation shape in VGG.

The tall stacked grid is called a feature map once we are past the input. Same picture, but the numbers no longer mean "brightness" — they mean "how strongly some detector fired here".


2. The sliding window: a convolution

Take a small square of weights — say numbers. Slide it across the image. At each stop, multiply overlapping numbers, add them all up, write the single result into a new grid. That single sliding-add is the convolution operation.

Figure — VGG networks

Why the topic needs this: VGG's entire claim ("stack small filters") is a claim about kernels. You cannot understand "two 3×3 = one 5×5" without first seeing what one 3×3 slide does.


3. Stride, padding, and the output-size formula

Two dials control how the window slides.

Figure — VGG networks

Now we can read the parent's output-size formula. Let be the input height and the output height:

Why this exact formula? is the padded height. Subtracting counts how far the window's top edge can travel before its bottom edge runs off. Dividing by counts how many jumps that is. The "" counts the starting position itself. Read it as: (number of jumps) + (the first stop).

For VGG's same-padding, and : Size is unchanged — that is what "same padding" means.

Edge / degenerate cases (so no scenario surprises you):

  • If (no padding), a conv shrinks the grid by 2 each side of the count: .
  • If (pooling-style stride), the grid roughly halves: .
  • The floor only bites when isn't divisible by — then some right-edge pixels are simply never a window centre.

4. Channels in, channels out — where and come from

A kernel doesn't just slide over one grid — it slides over the whole stack of input grids at once. So a single filter is actually a little box of weights: .

Each such box produces one output grid. Stack different boxes → you get output grids.

Figure — VGG networks

Why the topic needs this: VGG's "double the channels after pooling" is literally "double ". And every parameter count multiplies by these two numbers.


5. Counting the weights — the parameter formula

Now every symbol in the parent's parameter formula is defined, so we can earn it.

One filter box holds weights, plus one bias (a single "always-added" number per filter). There are filters:


6. Receptive field — the notation and

The parent note's headline result ("two 3×3 see a 5×5") is about the receptive field.

The stacking formula uses a product symbol. You must not meet unprepared:

Why this tool and not just "add kernel sizes"? Because a later layer's one-pixel step corresponds to several input pixels once earlier strides have spread things out — the product is exactly that spreading factor. For VGG all early strides are 1, so it stays simple. Worked, for three layers (all ):

See 3.6.03-receptive-field for the full geometric picture.


7. Pooling, ReLU, and floor — the last small pieces


Prerequisite map

Image as number grid H W C

Kernel 3x3 sliding window

Stride s and Padding p

Output size formula with floor

Channels Cin and Cout

Parameter count formula

Receptive field RF and product

Pooling and ReLU

VGG networks

Related building blocks in the vault: 3.4.01-convolution-operation (the slide itself), 3.4.05-alexnet (the large-filter network VGG improves on), 3.4.08-resnet and 3.5.02-batch-normalization (what came after), 3.6.03-receptive-field (deeper on RF), 3.4.15-transfer-learning (where VGG shines).


Equipment checklist

What does the triple mean?
A grid 224 pixels tall, 224 wide, with 3 colour channels (R, G, B) stacked behind each other.
What single number does one convolution window produce at each stop?
One number: the sum of (kernel weight × overlapping pixel) over the whole box.
What do and stand for?
The height and width of the kernel; for VGG both equal 3.
What does stride control?
How many pixels the window jumps each step; visits every location, halves the output.
What does "same padding" achieve, and what gives it for a 3×3 kernel?
Output size equals input size; use .
Write the output-size formula from memory.
.
What are and ?
Number of input grids a filter reads; number of output grids the layer produces (= number of filters).
Write the parameter-count formula and say what the +1 is.
; the +1 is one bias per output channel.
What does measure?
How many input pixels along one side feed a single output pixel at layer .
What does mean?
Multiply all strides through together.
What does (floor) do and why is it needed?
Rounds down to a whole number; grids only have whole pixels.
What does ReLU do?
Keeps positives, sets negatives to 0: — the network's non-linearity.