Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chapter 17 — Assignment Project: Finding Digits Anywhere

Open in Colab

Overview

A scanner reads digits from forms, but the digits are never in the same place: each is somewhere on a 24×24 patch, with some noise from the paper. You will show why a dense network struggles, design a small convolutional network under a parameter budget, test which design choices matter, and check how it behaves at positions it never saw in training.

PartTaskPoints
AA dense baseline15
BA CNN under a budget25
COne change at a time20
DPositions never seen20
ELook inside, and report20

Part A — A Dense Baseline (15 points)

  1. Train a dense network with two hidden layers of 128 ReLU units on the flattened patches (30 epochs, Adam at 10-3, with train). Report its parameter count, its training accuracy and its test accuracy.

  2. In two sentences, explain the gap using Section 17.1.

Your explanation:


Part B — A CNN Under a Budget (25 points)

Design a convolutional network with at most 30 000 parameters. Print a layer-by-layer summary (output shape, parameters, receptive field) and make sure the last convolution’s receptive field covers a whole digit (8×8) at least. Train it like the dense network and report the test accuracy.

Your design and its justification:


Part C — One Change at a Time (20 points)

Starting from your network of Part B, change one thing at a time and report the parameter count and test accuracy of each version:

  1. 5×5 kernels instead of 3×3;

  2. average pooling instead of max pooling;

  3. a flattened head (Flatten + Linear on the last feature maps) instead of global max pooling.

Which change matters most here, and why?

Your answer:


Part D — Positions Never Seen (20 points)

Build a new training set where every digit is in the left part of the patch (left edge in columns 0 to 6) and a test set where every digit is in the right part (columns 10 to 16). Train the global-pooling network and the flattened-head network of Part C on it, and test both on the left and on the right positions. Explain the result with equivariance and invariance.

Your explanation:


Part E — Look Inside, and Report (20 points)

  1. Show the first layer’s 16 filters of your Part B network, and the 16 feature maps of one test patch.

  2. One page for the scanner team: which network you recommend and why (accuracy, size, behaviour at new positions), what the filters show, and one test you would run on real forms before deployment.

Your report:

Grading Rubric

CriterionExcellentAdequateInsufficient
A (15)numbers and a clear link to locality and weight sharingnumbers onlymissing
B (25)within budget, summary with receptive field, justified designworks, no justificationover budget
C (20)one change at a time, the main effect explainedchanges mixedmissing
D (20)both heads, the invariance of global pooling explainednumbers onlymissing
E (20)filters shown and interpreted, a concrete recommendation and testgenericmissing