Tutorials · Chapter D (4/4) · ~10 min
When computers see
Play → read → next
Classify a tiny pixel grid — show “it’s an X” from numbers, not magic vision.
Playground
When computers see
Tiny pixel grids. Classify the shape — then see the model’s heuristic.
Recap
What you just did
You treated an image as data: brightness per cell → features → a label. That’s computer vision’s honest story. Whether the slate shows a digit, shape, or blob, you demonstrated: vision models classify arrays, then humans read the label.
Teach
How it works
A 3×3 “image” is just nested lists:
# 0 = dark, 1 = bright — a crude plus sign
img = [
[0, 1, 0],
[1, 1, 1],
[0, 1, 0],
]
flat = [p for row in img for p in row]
# toy score: how "plus-like" (center + mid-edge bright)
score = flat[1] + flat[3] + flat[4] + flat[5] + flat[7]
label = "plus" if score >= 4 else "other"
print(label, score)
Real models use huge grids and many layers — same idea: numbers in, class out.
Use it
When you'd use this
- Sorting photo uploads (document vs selfie)
- Spotting defects on a product line from stills
- Understanding why lighting and blur wreck accuracy
Watch out
Watch out
Tiny toys can be 100% accurate on 3 shapes and fail on real cameras. Also: privacy — faces and screenshots are personal data. Don’t train on people’s photos without consent.
Try next
Try this next
Make one pixel flip in your grid and re-classify. Did the label change? That’s how fragile — or robust — a pattern can be.