Deep Learning1 code example
⚡ +100 XP

Convolutional Neural Networks (CNN)

1

Why CNNs for Images?

A 224×224 RGB image has 150,528 pixels. A fully connected layer to 512 neurons would need 77M parameters — just for one layer. CNNs solve this with: 1. Local receptive fields — each neuron only sees a small patch 2. Weight sharing — same filter applied across all positions 3. Spatial hierarchy — early layers detect edges, later layers detect objects

2

Convolution Operation

Output = Input ★ Filter A filter (kernel) of size k×k slides across the input with stride s. At each position, element-wise multiply and sum. Output size = (W − k + 2p) / s + 1 Where W=input width, k=kernel size, p=padding, s=stride With padding=same: output has same spatial size as input.

3

Classic Architectures

LeNet-5 (1998) — First practical CNN. 5 layers. MNIST handwriting. AlexNet (2012) — Won ImageNet by 10%+ margin. Introduced ReLU, Dropout, GPU training. VGG-16 (2014) — Very deep (16 layers), all 3×3 convolutions. Simple and effective. ResNet-50 (2015) — 50 layers with skip connections. Won ImageNet 2015. EfficientNet (2019) — Compound scaling of depth/width/resolution. SOTA efficiency. ConvNeXt (2022) — CNN redesigned to match ViT. Pure CNN, modern training tricks.

4

ResNet with Skip Connections

💡

Skip connections solve the vanishing gradient problem — gradients flow directly through identity shortcuts, enabling 100+ layer networks.

Finished reading? Mark it complete to earn your XP.