PHASE 6 · DEEP LEARNING · ALGO 22/30

Convolutional Neural Network

The eye of deep learning — how machines see images
CNN pipeline infographic

Core Concept

A CNN is a neural network built for grid-like data such as images. Instead of connecting every pixel to every neuron, it slides small learnable filters across the image to detect local patterns — edges, then textures, then shapes, then whole objects. This spatial hierarchy lets it recognize a cat whether it sits in the corner or the center, using far fewer parameters than a plain ANN.

Key Components

🔲
Convolutional Layers
Small kernels slide over the input, computing dot-products to produce feature maps that highlight patterns.
🔻
Pooling Layers
Downsample feature maps (e.g. 2×2 max-pool), shrinking size while keeping the strongest signals.
🔁
Translation Invariance
Shared weights mean a feature is detected anywhere in the image, not just where it was trained.
🗺️
Feature Maps
Stacked activations forming a receptive-field hierarchy — low-level edges up to high-level object parts.

How It Works

  1. Feed the raw image (a grid of pixel values) into the network.
  2. Convolve learnable filters over it → feature maps; apply ReLU non-linearity.
  3. Pool to downsample, keeping dominant features and adding spatial robustness.
  4. Stack conv+pool blocks so representations grow from edges → textures → shapes → parts.
  5. Flatten and pass through fully-connected layers → softmax class probabilities.
  6. Backpropagate the loss to update all filter weights end-to-end.

Real-World Applications

🖼️ Image classification 🚗 Self-driving perception 🩺 Medical imaging 📷 Face recognition 🔍 Object detection 🎨 Style transfer

Checkpoint

What is a convolution — and what does a single filter actually compute as it slides over an image?
Why do CNNs outperform plain ANNs on images? (Think parameters, locality, and translation invariance.)
What role does pooling play, and what would you lose if you removed every pooling layer?