Teaching the Camera to Count Columns
A 3D-printed abacus can have anywhere from 3 to 21 columns. Here is how we taught the camera reader to count them, cut each column where it really is, and read it, what got better, and what still falls short.
When a child works a problem on a real abacus, the app can watch through a phone's camera and read the beads. Back in January that needed four small printed markers stuck to the corners of the abacus. Since then the camera has learned to find our 3D-printed abacus with no markers at all, and that finder is now live.
Finding the abacus is only half the job, though. Before the camera can read a number, it has to know how many columns the abacus has and where each one sits. We call the place where each rod sits in the frame its slot. This post is about teaching it that. The full method, data and numbers are in a companion technical report.
Why counting columns matters
The Abacus Studio lets you design and 3D-print your own abacus, at any width from 3 to 21 columns. The prints we use at home are 4 columns wide, and until now the camera quietly assumed every abacus was laid out like those:
- It squashed whatever it saw into the same 300 × 400 picture. At 4 columns each column gets about 72 pixels; at 10 columns, about 29.
- It split that picture into equal strips. On a real Studio print the columns don't sit in equal strips of the whole frame: the end columns are set in from the edges, so equal strips land beside the outer columns rather than on them.
- The part that reads each column had only ever learned from 4-column cuts.
So a 10-column print, or a 17-column one, was read through the wrong window. Seventeen columns matter in particular: 17 is a common width for a standard soroban, and a 17-column soroban is the next abacus we want the camera to read.
The chain, on one drawing
Every picture in this post is a drawing, not a photo. We render the Studio abacus from the same design file the Studio uses to print it, on thousands of made-up desks, with clutter, lamps, hands and pens, seen by a made-up phone on a stand. Because we drew them, we know the exact answer for every picture: where the corners are, how many columns there are, and which digit each column shows.
Two sets of drawings come up below. The check drawings are a few hundred we used while choosing settings. The unseen drawings are 2,424 the reader never learned from, kept back for scoring. Some scores start from exact corners, the true corners we know because we drew the picture; others start from the finder's corners, where the finder actually put them, a little off.
Here is one 10-column abacus going through the whole chain.
1. Find the frame. The marker-free finder outlines the abacus (blue). It works out which side is the top, so it knows which way to read.

2. Count the columns. A small network looks at the straightened frame and marks where it thinks each slot is (yellow lines). The curve under it shows how sure it is that a slot is there. It also gives its own count, and it only says a number when it is very sure and the count matches the number of marks.

3. Cut each column on its slot. Knowing the count, the camera knows the abacus's real shape, so it straightens the picture at that shape and cuts a window centred on each slot. The window is the same size at every width.

4. Read each column. Each window is turned grey and shrunk to a small picture, and the reader says which digit it shows and how sure it is.

Why "on its slot" matters
Here is the same 10-column drawing cut the old way and the new way. On top, the frame is squeezed into 300 × 400 and split into ten equal strips (red); the yellow lines are where the columns really are, and the strips drift off them toward the ends. Underneath, the frame keeps its real shape, and each window (green) is centred on its own column.

When the counter isn't sure
The counter is built to say "not sure" rather than guess. When it isn't sure, the app falls back on the column setting you already chose, exactly as before. Here are three cases:



On 210 check drawings with the whole abacus in view, the counter got all 210 right from exact corners. Working from the finder's corners it got 207 right, said "not sure" on 3 (where the finder itself had lost the frame), and was never confidently wrong. Those check drawings were also used to pick the counter's settings, so this is a first look, not a final score.
Read right at every width

Read wrong, and refused when covered
It doesn't always get it right. Here a 17-column abacus, small and dim in the picture, comes back with two wrong digits (red): a 7 read as 2, and a 5 read as 0. The grey row underneath is the true number.

Hands are the everyday problem. A child's fingers are often on the beads, and a column half under a finger can look like a different digit. We taught the reader that a covered column is "not a column" it should read; we call that version gate B. Here a drawn finger reaches over the two right-hand columns. The reader still reads the third one (correctly), refuses the last (?), and the app shows no number until the finger moves.


Before and after
We retrained the reader on slot cuts from 12,000 drawings at every width, then scored it on the 1,298 unseen drawings with every column in plain view, from exact corners. "Before" is the old reader, on the same new slot cuts; with the old even split it got only 60 % right (783 of 1,298). A number only counts as read when every column in it is read confidently; otherwise the app shows nothing and waits for the next frame.
| Columns | Right, old reader | Right, gate B | Wrong shown, old → gate B |
|---|---|---|---|
| 3 | 84 % | 99.5 % | 11 → 0 |
| 4 | 78 % | 96 % | 13 → 3 |
| 5 – 8 | 80 % | 98 % | 14 → 1 |
| 9 | 66 % | 95 % | 19 → 2 |
| 10 | 62 % | 92 % | 28 → 7 |
| 11 – 16 | 57 % | 91 % | 21 → 7 |
| 17 | 43 % | 86 % | 2 → 1 |
| 18 – 21 | 44 % | 80 % | 17 → 5 |
| All | 67 % | 93 % | 125 → 26 |
The bigger change shows up once hands and pens are allowed in the picture. Across all 2,424 unseen drawings, covered ones included, the reader that refuses covered columns showed 60 wrong numbers, against 284 before and 249 for a retrained reader that hadn't learned to refuse. The price is that it says "not sure" more often.
Where it stands
- It is not good enough yet. Our target is at least 99 % of numbers right, with at most one wrong number shown in 300, at 3, 4, 9 and 10 columns. On drawings with every column in plain view and exact corners, the retrained reader reaches that only at 3 columns. At 10 columns it gets about 92 % right. With the corners shaken the way the finder can be off, even 3 columns falls to 96 % (210 of 218, 2 wrong shown), so the target isn't met at any width. Reaching the target at every width is its own piece of work, after the 17-column soroban project.
- Every number here is measured on drawings. Drawings have no lens distortion, no smudges and no real lighting surprises. A real room will be harder, and we haven't scored it.
- It isn't switched on for everyone. The marker-free finder is live. Column counting and slot cuts are being tried at home on our own printed abaci. Nothing changes in the app for anyone else until that try goes well.
- The app has one advantage the drawings can't show. It waits for three frames in a row to agree before it accepts a number. That should catch many one-frame mistakes, but we can't measure that on still pictures.
What's next
- The reader. The mistakes we measured come mostly from columns partly covered by a hand or a pen, from heaven beads (the single bead above the bar, worth 5) caught partway along their travel, and from abaci that are very small in the picture. Each of those is something more targeted training can work on.
- A real room. Trying it on real prints, at real desks, is the test that counts.
- The 17-column soroban. A standard soroban is a different abacus from a Studio print, often 17 columns wide. It is the next project.
For the geometry, the training recipes, the full tables and everything that didn't work, see the technical report.
