A cat detector looks at a photo and scores every spot: how much it looks like the tip of an ear (high is ear-like, below zero clearly not). To look wider, the next layer needs that map a quarter the size: each 2 × 2 window of spots becomes one spot. Write shrink(window): given one window’s four scores, return the one score that stands for them, without losing an ear.
Two cats and a cat detector’s map of them: each spot scored for how much it looks like the tip of an ear. Shrinking the map by averaging each 2 × 2 window loses the kitten’s ears. The goal is the small map it ends on. Your shrink(window) gets one window’s four scores.
shrink(window)| window | 2x2 ear scores (a numpy array), four neighbouring spots of the detector's map window[0] is its top row, window[1][1] its bottom-right spot | e.g. [[0, 0], [0, 0]] |
| returns | one score for the whole window, for the map a quarter the size | |