Lessons › Chapter 9: Computer vision
CNN architectures
Most vision networks follow one recipe: repeat “convolution, ReLU, pooling” a few times, then finish with ordinary dense layers. Here is that pipeline, left to right.
Watch it move. This lesson is interactive on Gradient Lab: every step is an animated scene you can replay.
Start the interactive lessonStep by step
Picking a design
Rather than inventing a network from scratch, Leo picks a design that is known to work.
The classic recipe
Most vision networks follow one recipe: repeat “convolution, ReLU, pooling” a few times, then finish with ordinary dense layers. Here is that pipeline, left to right.
Shrink and deepen
Each block makes the maps smaller (pooling) but deeper (more filters). The network trades “where exactly” for “what kind of thing”.
Classify at the end
At the end, the maps are flattened into one long list of numbers and fed to dense layers, then a softmax gives a probability for each class.
Skip connections: going very deep
Very deep networks used to get worse as layers were added. ResNet fixed this with skip connections: shortcuts that add each block’s input to its output. Signals and gradients can flow along the shortcuts, so networks with 100+ layers train well.
In real life: a second pair of eyes on X-rays
Hospitals use vision networks to help doctors by flagging scans that may need a closer look, such as a possible fracture or a spot on a lung. The network sorts the pile; a radiologist makes the decision.
Quick check: What do skip connections (as in ResNet) do?
- Add a block’s input to its output so very deep networks still train (correct)
- Skip some of the training images
- Remove all pooling layers
The shortcut gives signals and gradients an easy path through many layers.
Pseudocode
image → [convolution → relu → pooling] × several blocks # shrink, deepen → flatten into one long list → fully connected layers → softmax over the classes # ResNet adds shortcuts: output = block(x) + x
Key terms
- skip connection
- A shortcut that adds a block’s input to its output, so very deep networks keep learning.
In the news
Recent models and papers that build on this idea: