Lesson 5.2core2 h 30 min⚡ live demo

CNN building blocks

Pooling, 1×1 convs, depthwise, dilated and transposed convolutions

Real networks are assembled from a small vocabulary of blocks: convolution + normalization + activation, pooling or strided downsampling, 1×1 channel mixers, and (for dense prediction) upsampling layers. Knowing the cost and purpose of each block lets you read ResNet, MobileNet or U-Net tables at a glance (5.3 Architectures: LeNet → AlexNet → VGG → Inception → ResNet → EfficientNet → ConvNeXt, 5.6 Segmentation), design networks that fit a latency budget, and recognize the same ideas inside transformers, where the feed-forward layer is a 1×1 convolution in disguise (7.4 Inside the block: residuals, LayerNorm, FFN and embeddings).

You'll be able to

  • Describe the stem–stages–head anatomy of a CNN and how resolution and channels trade off
  • Explain max/average/global pooling and when strided convolution replaces pooling
  • Compute the cost of standard, 1×1, depthwise-separable and dilated convolutions, and the separable savings ratio
  • Explain transposed convolutions, their output-size formula and checkerboard artifacts
  • Count the parameters and FLOPs of a complete small CNN

Key ideas

  1. CNN anatomy: a stem that downsamples fast, stages that halve resolution while doubling channels (keeping compute roughly constant), and a GAP + linear head.
  2. Max pooling adds invariance and quarters downstream compute for free; strided convolutions learn their own downsampling and have replaced pooling in many designs.
  3. A 1×1 convolution is a per-pixel fully connected layer (C_in·C_out parameters) used for bottlenecks and cheap nonlinearity; the transformer FFN is the same operation on tokens.
Show 4 more key ideas
  1. Depthwise-separable cost ratio = 1/C_out + 1/k² ≈ 1/9 for 3×3 kernels — MobileNet, Xception and ConvNeXt's large depthwise kernels rest on this.
  2. Dilation grows receptive fields exponentially without downsampling: effective size k + (k−1)(d−1).
  3. Transposed convolution upsamples with output (n−1)s − 2p + k; kernel/stride mismatch causes checkerboard artifacts, so upsample+conv is often preferred.
  4. Parameters concentrate in FC layers, compute in conv layers — count both before trusting an architecture table.

Suggested path through this lesson