● building · rung 08, detection
A Vision Transformer built from scratch that looks for dividing cells.
fig. 01
Finding dividing cells, on a tumour type it has never seen.
Karyo takes H&E histology images and marks mitotic figures, cells caught mid-division, as points. Pathologists count these to grade tumours.
The core problem is domain shift. Evaluation is leave-one-tumour-type-out: train on six tumour types, test on a seventh the model has never seen, across species, labs and scanners.
It exists to find out how far a small, hand-built model gets on a domain it has never seen. It is a research model on a public benchmark, MIDOG++. It is not a diagnostic tool.
The name: karyon, Greek for nucleus, and karyokinesis, the nucleus dividing.
fig. 02
One forward pass, with the shape at every boundary. Flip the toggles. Hover or tap a block.
S = 384 · B = 32 · grid 48×48
training window
(B, 581, 192) → (B, 581, 192)
stride-8 feature map · both backbones meet here
(B, c, S/8, S/8). The two heads are identical in structure, differing only in input width.
heatmap logits and offsets run in parallel, and rejoin in decoding
backbone subtotal 5,597,952 · total counted at 384 px
fig. 03
The same weights, two kinds of window. Training on the left, inference on the right.
training
(32, 384, 384, 3) uint8
inference
(16, 512, 512, 3) uint8
(B, 3, S, S) float in [0, 1]
(B, 1, S/8, S/8) + (B, 2, S/8, S/8)
training
inference
training
inference
inference
(x, y, score) per region
fig. 04
Rungs 0 to 14. A rung is done when its tests pass, not when the loss goes down.
fig. 05
Why it is built this way.
Leave-one-domain-out, split by case. The held-out domain touches nothing: no pretraining, no normalisation stats, no early stopping, no threshold. The code asserts it by case ID.
The NumPy engine from the first three rungs is never modified. Later code is checked against it. Gradient checks run in float64.
The tests get tested. Break the code on purpose, then confirm a test fails.
Each experiment's keep-or-drop number is written down before it runs. Decisions use training-domain validation only. A failed gate is recorded as a result.
fig. 06
Six items.
fig. 07
Results, experiments and failures live in Briefs and Logs.
Nothing tagged Karyo yet. The slide is still on the stage.