In Lab 1 the MLP flattened every image. A CNN keeps the 2D structure. Explore convolution, pooling, Dropout, BatchNorm and augmentation here, then build and compare CNNs on CIFAR-10 in Colab.
Each output cell is a weighted sum of a small window of the input, and every position uses the same kernel weights. Pick an image and a kernel, then click an output cell to see its window and arithmetic.
Keras computes this sum without flipping the kernel, exactly as the formula is written. Positive output is shown in red, negative in grey. The vertical-edge kernel lights up where dark meets light going left to right.
Work out the shape after each layer and where the parameters sit. Compare your numbers with model.summary() in Colab.
A 3×3 Conv2D with same padding versus a Dense layer connecting the same inputs to the same outputs. The defaults are Conv2 of the baseline.
Neither layer adds a feature detector. Dropout makes the network harder to memorise with. BatchNorm keeps each layer's inputs in a steady range so training is faster and smoother.
Keras uses inverted dropout. Surviving units are scaled by 1/(1 − p) during training, so on average the layer's output matches inference and nothing changes when you evaluate.
Whatever the earlier layers do to the batch, the output is re-centred and re-scaled. γ and β are learned, so the network can undo the normalisation where it helps. Each BatchNorm layer has 4 values per channel: γ and β are trained, the running mean and variance are not.
The network sees a slightly different version of each image on every epoch, so it cannot rely on one exact pose. In Keras the augmentation layers run only during training and pass images through unchanged at inference. This scene is drawn on the page as a stand-in for a CIFAR-10 image.
RandomRotation(0.1) turns by up to ±10% of a full circle, which is ±36°. RandomZoom(0.1) zooms in or out by up to 10%. Empty corners are filled by reflecting the image.
Choose a setup and watch the training and validation curves. The curves are a simulation tuned to typical CIFAR-10 behaviour for this architecture. Your Colab numbers will differ, but the ordering and the shapes should look familiar. The baseline is drawn dashed for comparison.
Copy each cell into Colab and run them in order. Setup, data loading and preprocessing are one card because they run together. Task numbers match the lab sheet.
Answers are saved in this browser only. Open a hint after you have tried.