Convolutional Networks for Vision

2 min

Objective: understand convolution, channels, pooling and receptive field.

A dense layer ignores spatial structure and quickly multiplies parameters. A convolution applies the same small kernel at every position. This weight sharing exploits locality and drastically reduces the number of parameters.

For an input C_in × H × W, a kernel C_out × C_in × K × K contains C_out(C_in K² + 1) parameters with bias, regardless of the image size.

python
from torch import nn

features = nn.Sequential(
    nn.Conv2d(3, 32, kernel_size=3, padding=1),
    nn.BatchNorm2d(32),
    nn.ReLU(),
    nn.MaxPool2d(2),
    nn.Conv2d(32, 64, kernel_size=3, padding=1),
    nn.ReLU(),
    nn.AdaptiveAvgPool2d((1, 1)),
)

Preview — the rest of the lesson is for enrolled readers.

Already enrolled with a code?

Your access is tied to your account, not to this link. Sign in with the same email you used in class: your course is waiting, no need to enter the code again.

Sign inNo account yet? Create one
This lesson is part of the “Specialized Architectures” module

The first modules of the course are open to everyone. For the rest you have three options: buy this course once and for all, subscribe, or enter the code handed out in class.

Are you a student on this course?

The code is tied to your account: sign in or create an account and it will be applied automatically when you come back.

No account yet? Create one