Why images break MLPs
Why it matters Your digit reader from Module 3 scored about 95%, and the slightly bigger one in this lesson scores about 98%. Move each digit one pixel to the right and it collapses. Seeing why is the whole reason convolutional networks exist.
An MLP gives every pixel its own weight. It learns "a bright pixel at row 3, column 5 means a 7". Shift the digit one pixel and every bright pixel lands on a weight that learned something else. To the MLP, a shifted 7 is a brand new picture.
What we want is a network that recognises a pattern wherever it appears. Hold that thought; the next lesson builds the tool.
Translation invariance: giving the same answer when the input is moved around. MLPs do not have it; CNNs mostly do.
Words and symbols in this lesson
- convolution
- sliding a small grid of weights (a filter) across an image, one dot product per position
- filter, feature map
- the small learned grid of weights; and the image of its responses
The digit images come as an array of shape (N, 8, 8, 1): N images, 8 rows, 8 columns and 1 channel last (grey level from 0 to 1). This channels-last layout is used for every image in this module. Write shift(X, dx) that moves every image dx pixels to the right (use np.roll along the column axis). Then fill acc with the trained MLP's test accuracy at shifts 0, 1 and 2.
Spotted a problem in this lesson? Report it · Ask about this lesson
This exercise opens soon
Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.
This browser is blocking cookies for learn.floati.life, so lessons you finished here cannot open in order. Allow cookies for this site and reload.