Convolutional Neural Networks

Vismay Shanbhag

Lecture notes on convolutional neural networks, pooling, feature hierarchies and batch normalization.

Every figure can be played, or stepped through with Next.

Part 1Why Not Dense Layers for Images?

Part 2The Convolution Operation & ReLU

1. Visual Picture (6×6)
2. Pixel Numbers (0-255)
∗
3. Filter (3×3)
=
4. Output Map (4×4)
Click 'Play' or 'Next' to slide the 3×3 filter and calculate dot products.
Step 0 / 16
Output Size = ⌊ W − K + 2P S ⌋ + 1
Formula Breakdown: Input size W = 6, Filter size K = 3, Padding P = 0, Stride S = 1.
Plugging in the numbers: ⌊ (6 − 3 + 0) / 1 ⌋ + 1 = 3 + 1 = 4 × 4 output map.

Part 2bRGB 3-Channel Convolution

■ Red Channel (8×8)
■ Green Channel (8×8)
■ Blue Channel (8×8)
Combined RGB (8×8)
ONE Shared 3D Filter (3 × 3 × 3 = 27 weights): Reused across all 36 patch positions (click weights to edit)
■ Filter R (3×3)
+
■ Filter G (3×3)
+
■ Filter B (3×3)
=
Output Map (6×6)
Click 'Play' or 'Next' to slide the 3×3×3 filter volume over the RGB image.
Step 1 / 36

Part 3Feature Hierarchies

CNN Feature Hierarchy Flow: Yellow Car to Low, Mid, High Features and Classifier
End-to-End Visual Hierarchy: An input image (yellow car) passes through successive convolution layers, building representations from oriented edges to complex semantic parts.
Layer 1 • Low-Level

Edges & Opposing Colors

Layer 1 Low-Level Feature Map Grid
Layers 2–3 • Mid-Level

Textures, Curves & Motifs

Layer 2-3 Mid-Level Feature Map Grid
Layers 4–5 • High-Level

Object Parts & Assemblies

Layer 4-5 High-Level Feature Map Grid

Part 4Pooling & Spatial Downsampling

Feature Map (6×6)
→
Pooled Output (3×3)
Click 'Play' or 'Next' to step the 2×2 pooling window.
Ready. Press 'Play' or 'Next' to downsample the feature map.
Step 0 / 9

Part 5Batch Normalization

Iteration 1 / 6 (8 batch activation points traveling through Layer 2)
0
μ = 0.0
Batch Mean (μ)
0.0
Batch Spread (σ)
1.0
Downstream Layer 2 Status
Optimal Inputs
Click 'Play' or drag the iteration slider to watch the activations drift across training updates.
Iteration 1 / 6
Normalized = γ × x − μB √(σB2 + ε) + β
0
μ = 22.3
Mean (μB): 22.3
Spread (σB): 20.6
Current Step: 1. Raw Inputs
Ready. Click any step below or press 'Auto Play' to see how BatchNorm standardizes wild activations into stable numbers.
Step 1 / 4

Part 5bBatchNorm in CNNs (4D Tensors)

Mini-Batch of N = 4 Images × H × W = 3 × 3 Activations (36 total values in Channel 0):
Activation Distribution (Channel 0) Mean: +14.2 • Std: 5.8
Step 1 (Raw Activations): Showing mini-batch activations across N=4 images. Notice how the channel is off-center with wide variance.
Step 1 / 5
Training Dynamics: With vs. Without BatchNorm
Drag the learning rate slider to see how BatchNorm prevents gradient explosions:
0.010
With BatchNorm: Stable convergence (Final Loss: 0.08)
Without BatchNorm: Slow descent (Final Loss: 0.35)
— With BatchNorm — Without BatchNorm