Re-Learning ML on my Blackboard

You gotta work bitch

I learn best at a blackboard. Engineering Science at Oxford taught me that you don’t understand a concept until you’ve done it standing up, on a whiteboard, with someone watching who will eagerly tell you when (but not where) you fucked up.

Frequently I fear I’ve atrophied in a number of ways since I did ML in my undergraduate. :oof: I decided to make my own course to properly learn modern machine learning, from SVMs up to RL for reasoning models - but I wanted it with the sensation of a tutorial.

So on Friday I opened Claude Code and asked for a course “starting simple (SVMs, kernel trick)”, where I could work from a web page and papers. I also wanted to use the chalkboard on my wall to draw and derive things, and to have a webcam watching so the AI could grade me.

One session later I have a course page, a camera rig, and a strict tutor watching my board.

The blackboard grading rig The webcam looks at the blackboard. board.py snap sets the board light to brightness 200 at 6500 K over the Home Assistant REST API, grabs 45 warm-up frames then averages 12, dewarps the four hand-picked corners to a 1600 px tall board, enhances chalk into dark ink, and restores the light's previous state. When I say 'grade 1.1', Claude reads the colour and cleaned snaps, marks the rubric and writes data/grades/d1-1-<stamp>.json, which serve.py on localhost:8765 hands to the course page, polling every 4 s. lightslooks atsnaps/*.jpg board lightHome Assistant blackboardgreen, portrait C200 webcam2560×1440 MJPEG board.py snap light onbrightness 200, 6500 K grab45 warm-up, mean of 12 dewarp4 corners → 1600 px tall enhancechalk → dark ink light restoreexact previous state “grade 1.1” Claudereads, zooms, marks data/grades/d1-1-<stamp>.json serve.pylocalhost:8765 course pagepolls every 4 s

The course

The course is one local HTML page: 31 modules in seven parts.

  1. Classical foundations: margins, kernels, generalisation, ensembles, latent variables.
  2. Deep learning: backprop, loss functions and activation functions (each gets its own module), convnets, optimisation, attention, generative models, RL foundations.
  3. Transformers and LLMs: the modern transformer in detail, pretraining at scale, efficient inference, long context.
  4. Post-training and reasoning: RLHF, DPO, GRPO and the R1-style RL for reasoning, agents and evaluation.
  5. Multimodal: ViT and CLIP, VLMs, diffusion and flow matching at scale.
  6. Research frontier: interpretability, deep-learning theory, and a capstone defended at the board.
  7. Ilya’s reading list: the ~30 papers Ilya Sutskever reportedly gave John Carmack. It was never officially published, so it’s the 27-item version that circulates.

There are 177 papers, a coding lab per module, and 114 blackboard drills. :aaah: A drill is a short prompt with a marking rubric. Drill 1.1, for example:

In 2-D, draw two classes (× and ○) that are linearly separable. Draw the separating hyperplane, both margin lines, the normal vector w w , and circle the support vectors. Label the three lines with their equations and mark the margin width.

The rubric has five lines: w w perpendicular to the boundary and pointing to the + class; margins parallel, equidistant and labelled w ⊤ x + b = ± 1 w^\top x + b = \pm 1 ; boundary labelled; support vectors on the margins with none inside; width labelled 2 / ‖ w ‖ 2/\lVert w\rVert .

The hardware

  • An Anker PowerConf C200 webcam on /dev/video0. Its best mode is MJPEG at 2560×1440 @ 30fps.
  • A green chalkboard in an aluminium frame, portrait, on the wall across the room. It fills only about 600×900 px of the frame, at an angle (the right edge is nearer the camera).
  • An IKEA KAJPLATS GU10 bulb (470 lm, colour and white spectrum) above the board, controlled through Home Assistant.
  • A Linux desktop with an RTX 2060 SUPER. (yes I’m GPU poor :sadcat:)

Finding the board

The camera is fixed, so the whole job is: find the four corners of the board once, then warp every snapshot into a flat, upright rectangle. Since my webcam doesn’t move it’s trivial to just get your agent to measure it. :dr-evil:

Claude cropped 120 px windows around each corner, overlaid a 10 px grid, read the corners off them, and wrote them to board.json. board.py calibrate --manual (click the four corners) is the fallback if the camera ever gets knocked.

Focus

With the corners fixed, the board was still blurry. Autofocus had locked onto the nearest large object, which was my head. :gumi:

The same patch of board under autofocus (left, a smear: the camera focused on me) and with focus locked at 450 (right, every subscript readable)

To resolve this I elected to turn autofocus off and sweep the focus while scoring each setting on the dewarped board only. To score a focus configuration I used Tenengrad (mean squared Sobel gradient) on the board at roughly native resolution. Annoyingly the lens/MJPEG pipeline takes a small amount of time to settle after a focus change - approximatley 20 frames, which I had to factor in with a settling time.

My focusing calibration uv run board.py focus searches coarse to fine:

  1. Coarse: every 20 units over the whole range.
  2. Fine: every 4 units over ±24 around the coarse peak.
  3. Exact: every 1 unit over ±5 around the fine peak, run twice and averaged, then a parabola through log-sharpness at the top three points. (Isn’t AI assistance insane?) :mindblown:
def _score_at(cap, corners, f, settle=20, n_avg=3):
    set_focus(f)
    for _ in range(settle):  # lens move + MJPEG pipeline lag
        cap.read()
    frames = [cap.read()[1].astype(np.float32) for _ in range(n_avg)]
    return sharpness(np.mean(frames, axis=0).astype(np.uint8), corners)

c, _ = sweep("coarse", range(300, 651, 20))
f, _ = sweep("fine", range(c - 24, c + 25, 4))
e, sc = sweep("exact", range(f - 5, f + 6), repeats=2)

Coarse-to-fine focus search Tenengrad sharpness inside the dewarped board against focus_absolute. Left: a coarse pass every 20 from 300 to 650 peaks near 460, then a fine pass every 4 from 436 to 484 peaks at 452; the 300 reading is a stale frame from before the lens settled. Right, zoomed: an exact pass every 1 from 447 to 457, averaged over two runs, is flat to within about 2% between 449 and 455 and peaks at 452, which a parabola fit confirms. 02k4k6k8k300400500600 focus_absolute stale frame coarse, every 20 fine, every 4 6.8k7.0k7.2k7.4k7.6k446450454458 focus_absolute (zoomed) 452: peak + fit exact, every 1 (mean of 2) sharpness (Tenengrad)

It takes about 40 seconds and landed on 452. The top of the curve is flat to about 2% between 449 and 455, which is roughly as finely as this camera can tell focus apart. The result is saved in board.json, and every capture sets it before grabbing frames to ensure the sharpest possible capture.

Light and noise

I’m Gen Z (surprisingly) so I like my office moodily lit. :vibecat: This annoying fact means the camera turns its gain up, and the MJPEG encoder turns the resulting noise into blocks. Chalk is also somewhat faint, and blocks look a lot like chalk.

To try and combat sensor noise, every snapshot averages 12 frames. We can do better and make more light get to the sensor though..! As I’m a bit of a nutter and I love having a smart home I can make the capture proceedure temporarily turn on the spotlight above the blackboard to get more light into the sensor. :party-will: snap reads my spotlight’s state from the Home Assistant REST API, sets it to a known colour (pastel magenta for the photo Claude grades from, then 6500 K white for the one I see; see the light test below), waits a second, grabs with extra warm-up frames so auto-exposure settles, and then puts the light back exactly as it was.

prev = light_state()
light_on(brightness=200, color_temp_kelvin=6500)
time.sleep(1.0)
try:
    img = grab(warmup=45)  # extra frames so auto-exposure settles after the light change
finally:
    light_restore(prev)    # off, colour temperature or hue: whatever it was before

From photo to something gradeable

The capture pipeline is short:

  1. average the frames;
  2. perspective-warp the four corners (cv2.getPerspectiveTransform) to an upright board 1600 px tall;
  3. enhance(): greyscale, subtract a 61 px median blur (this removes uneven lighting and chalk-dust smear), normalise, CLAHE, then a soft threshold between the 70th and 99.7th percentiles, inverted so chalk becomes dark ink on white.

It saves the dewarped colour image, the cleaned one, and latest* copies for Claude to read.

The same board three ways: the raw camera crop at an angle, the dewarped colour board, and the enhanced version with chalk as dark ink on white

Claude reads both of these outputs. The cleaned image is better for strokes; the colour one catches faint chalk the threshold throws away. (At least, I think it is? Claude thinks it is? I’m not sure if this is true). :confused-dog:

The grading loop

The grading loop I draw at the board and say 'grade 1.1' in Claude Code. Claude runs board.py snap, reads the colour and cleaned images and zooms where unsure, marks each rubric line with half marks allowed, and writes a JSON grade with feedback. The page updates, showing the photo if the score is at least 80%. Below that I get what to revisit and redraw; a viva question can follow. under 80%: what to revisit,then redrawthen a viva question drawchalk, no notes “grade 1.1”in Claude Code snapboard.py read + zoomcolour and clean mark rubric½ marks allowed write gradeJSON + feedback page updatesphoto if ≥ 80%

Once I’ve made a pathetic effort at a task :gun: I say “grade 1.1” in Claude Code. Claude runs board.py snap 1.1, reads the images, zooms into crops where it’s unsure, scores each rubric line (half marks allowed), and writes something like:

{"drill": "1.1", "score": 5, "outOf": 5, "gradedAt": "2026-11-21T00:35:22Z",
 "snap": "snaps/20261121-003522_1.1.jpg", "feedback": "Full marks. ..."}

The feedback is a few sentences with LaTeX, which the page renders. At 80% or above the board photo is attached, and the page shows the photo from my best attempt.

The course page for module 1: the module list down the left, then key ideas, a reading list with the Burges SVM tutorial ticked off, and the blackboard drills. Drill 1.1 shows “solid, 5/5” with the board photo of my maximum-margin drawing and Claude’s feedback underneath; drill 1.2 is not graded yet

The whole protocol (how to snap, what to ignore on the board, how strict to be, the JSON shape, when not to grade) is in the project’s CLAUDE.md. That makes the tutor stateless: any future session can pick up and grade.

Super-resolution

The board only fills about 600×900 pixels of the camera frame, so small subscripts are a few pixels tall. I asked Claude to see whether super-resolution could help, on my RTX 2060. I guided it to be particularly careful around inventing or erasing marks - which would be detrimental to any accurate scoring.

The answer was “it’s probably not worth it” :cat-no::

  • Multi-frame super-resolution needs sub-pixel shifts between frames, and a webcam bolted to a wall doesn’t wobble. Across 60 frames the median shift was 0.02 px (largest 0.04), so shift-and-add on a 2× grid came out identical to plain averaging. The MJPEG blocks sit in the same place every frame, so averaging can’t remove them either.
  • More frames barely help: board noise goes from 0.88 grey levels at 12 frames to 0.71 at 60. As far as I understand - MJPEG had already smoothed most of it.
  • Learned upscalers (Real-ESRGAN, SwinIR) took 2–17 s a frame and produced the crispest-looking chalk of the lot. The sting in the tail is that they turn uncertain strokes into confident ones. They also thin strokes and add dark outlines. Nothing outright vanished on this board, but “maybe wrong” is exactly what I don’t want a grader to see.

The same handwriting four ways: the current pipeline, shift-and-add over 60 frames (identical), and two GAN upscalers that look crisper but redraw faint marks with false confidence

Choosing the light

Since the optics are the limit, the other free knob is the light. The board is green (ish) and the chalk is white, so in principle a coloured light that the board absorbs and the chalk reflects should raise the contrast between them. Before testing that, it’s worth seeing how green the board really is to the camera. Under white light, here’s the board’s brightness as a fraction of the chalk’s in each of the camera’s three colour channels:

What each camera channel sees Under white light, the board's brightness as a fraction of the chalk's, in each camera channel. With 6500 K light: blue 0.59, green 0.58, red 0.44; the 4000 K and 2700 K whites give similar values (red 0.44 to 0.46). The board is darkest relative to the chalk in red, so light rich in red should help a little, but the board is a dull grey-green and the margin is small. 0.00.20.40.6 blue channel 0.59 green channel 0.58 red channel 0.44 board ÷ chalk brightness bars: 6500 K whitedots: 4000 K, 2700 Klower = darker boardbehind the same chalk= more contrast The board gives up mostin red, but only a little:0.44 against about 0.55.

The board gives up the most in red, which is what you’d expect from something green, but not by much. To the camera it’s a dull grey-green, not a saturated one, so physics promises a modest gain from red-rich light at best. And a coloured LED is much dimmer than white, so the camera turns its gain up and the noise with it. That’s a trade-off only a measurement can settle.

I had the bulb cycle through 15 settings (three whites, nine colours, two pastels, room light only) and photographed the same handwriting under each.

A blind reading test

I asked for a test that measures the thing I actually care about: can a model read it? Each photo was cropped to the same six lines of my derivation, given a random file name so the colour couldn’t be guessed from it, and handed to independent Claude Haiku subagents, one image each, with instructions to transcribe exactly what’s there and mark anything unreadable. Transcripts were scored against the true text: character error rate, plus whether the marks that matter for grading (superscript T, hats, subscript 0s, minus signs, ‖w‖) survived.

At full size it was a ceiling: 12 of the 17 photos were transcribed perfectly, so at my normal handwriting size any decent light is fine. Shrinking the crops to 30% (about what smaller writing or a further camera would give) pulled the lights apart.

The blind reading test, read by read Character error rate of each independent transcription of the same six lines at 30% scale, one row per light, with a bar at the mean for lights read more than once. Purple (mean 0.7%) and pastel magenta (0.8%) cluster at zero; 6500 K white averages 3.1% and red 3.3%; pink has one bad read at 26%; 4000 K white, pooled over two photos and ten reads, averages 10% with reads from 2% to 22%. Nine lights were read once and dropped: blue 3.3%, orange and pastel red 4.1%, room light 5.7%, green 6.5%, cyan, magenta and yellow 7.3%, 2700 K white 11.4%. 0%5%10%15%20%25% character error rate, 30% scale reads purple 5 pastel magenta 5 6500 K white 5 red 5 pink 5 4000 K white 10 below: read once; not perfect, so not re-tested blue 1 orange 1 pastel red 1 room light only 1 green 1 cyan 1 magenta 1 yellow 1 2700 K white 1

The same six lines at 30% scale under six lights, with each light’s mean transcription error rate: white 4000 K 10%, white 6500 K 3.1%, green 6.5% (one read), red 3.3%, purple 0.7%, pastel magenta 0.8%

The commonest error tells me something about my handwriting rather than the light: at small sizes my “d” looks like a “t” to haiku. :hurtrealbad: The physics vaguely held up: the three best lights all contain red, and green, cyan and yellow - the colours the board reflects best - all sat in the bottom half. But saturated magenta and pink contain red too and didn’t do well, so I wouldn’t push that story further than “vaguely”. Purple and pastel magenta are a tie on five reads each, and I photographed each light once, so I wouldn’t stake much on the ordering at the top.

6500 K white scored a poor 3.1%, level with red: four of the five reads lost the faint “+ b” at the end of the first line, which is exactly the kind of mark a grade can hinge on. 4000 K white came to a much worse 10%, more than ten times purple’s. The useful result is that the original snap light I tried was among the worst settings in the test - so we picked up a nice improvement for free! :headbangparrot:

With purple and pastel magenta tied, I broke the tie by eye: pastel magenta looked clearest to me too. snap now takes two shots: a pastel-magenta one that Claude grades from, and a 6500 K white one that goes on the course page, because a magenta photo of my work isn’t much fun to look at. :myeyes: Each shot takes about five seconds, mostly letting auto-exposure settle on the new colour. But only the magenta shot is for Claude, so on a snap the magenta shot is taken, the command returns, and a detached background process takes the white one and restores the light while Claude is already reading.

One snap, timed A real snap. The light turns pastel magenta at 0.18 s; after a 1.5 s settle the camera grabs from 1.68 to 4.91 s, and at 5.03 s the command returns and Claude starts grading. Meanwhile a background process turns the light to 6500 K white at 5.08 s, grabs the course-page photo from 6.22 to 9.35 s, and restores the light to what it was at 9.46 s. board lightcameraClaudeyoursyours, restoredThe white half runs in a detached background process; the next snap waits for it. pastel magenta 6500 K white settle grab → Claude grades this settle grab → course-page photo waiting reading the board, marking 0 s2 s4 s6 s8 s10 s

Notes

I got this done in a couple hours one evening. This sort of work with agents is genuinely fantastic - stuff that can enrich my life rather than dominate it.

Testing out ideas such as super-resolution and varying light colours on a hunch was ‘free’ to try out and yielded useful results. I use this pattern a lot at work - I develop a thing but have lots of “spikes” going on at the same time to try and spider out for interesting ‘out there’ gains.

Next up is Module 2: duality and the kernel trick.

It’s shocking how much I’ve forgotten, but surprising how much I am able to recall when pressed. :duality:

Time to waste some more Hagoromo chalk :meowheartbongo:

1 kudos