Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ python tools/generate_corpus_thumbnails.py # → site/assets/images/corpus/
```

Backend names: `tesseract`, `tesseract-auto`, `easyocr`, `easyocr-hy`, `paddle`,
`paddle-vl`, `claude`, `marker`, `vision`, `auto-local`. `easyocr-hy` is stock EasyOCR with
`paddle-vl`, `claude`, `claude-haiku`, `marker`, `vision`, `auto-local`. `easyocr-hy` is stock EasyOCR with
the project's own Armenian recogniser swapped in — its own name, like
`tesseract-auto`, so the harness scores the difference rather than asserting it. `vision` is macOS-only — Apple's Vision
framework via `ocrmac`, declared with a `sys_platform` marker so `[all]` still
Expand All @@ -116,7 +116,8 @@ needs the `qa` extra, checked up front rather than on the first file.

**The backend interface is fixed.** Every backend exposes
`SUPPORTED_EXTENSIONS: set[str]` and `ocr_image(path: Path, ...) -> str`.
Tesseract adds optional `contrast`, `psm`, `auto` and `lang`. Nothing else varies. That
Tesseract adds optional `contrast`, `psm`, `auto` and `lang`, and Claude an
optional `model`, which is how `claude-haiku` differs from `claude`. Nothing else varies. That
uniformity is what lets `registry.py`, the batch pipeline and the harness treat
backends interchangeably; a backend that needs a different signature needs an
adapter, not a special case in the callers.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ top of them.
| `paddle-vl` | `[paddle-vl]` | ✓ | Document vision-language model. Reads PDFs and multi-page TIFFs; strongest local engine measured, but minutes per page. Join it to auto-local with `--with-paddle-vl` |
| `marker` | `[marker]` | ✓ | Layout-aware document conversion — the only local backend that models reading order |
| `claude` | `[claude]` | ✓ | The Anthropic vision API. Reads material no local tool can |
| `claude-haiku` | `[claude]` | ✓ | The same API with Anthropic's smallest current model. Cheaper, and measurably worse on the material `claude` is for |
| `auto-local` | `[qa]` | ✓ | **The recommended default.** Runs the viable local engines, scores each, keeps the best |

A few things worth knowing before you pick one:
Expand All @@ -231,6 +232,9 @@ A few things worth knowing before you pick one:
- **`marker` is slow and GPU-gated inside `auto-local`.** It is the only local
engine that gets multi-column newsprint into the right reading order, and it
takes roughly 18 minutes of a 70-minute benchmark run to do it.
- **`claude-haiku` is not a cheaper `claude`.** On the posters local engines
cannot read, it leaves out imprints and small lines and sometimes puts
plausible wording in their place. Use `claude` for escalation.
- **`claude` sends your images to an API** and needs `ANTHROPIC_API_KEY`, which
rules it out for confidential material. It also does not reproduce between
runs — it recovers the same words and orders them differently. It is the
Expand Down Expand Up @@ -340,7 +344,7 @@ tetrak-ocr batch --backend tesseract-auto --quality-gate
### Supported files

JPEG, PNG and TIFF everywhere; PDF on `tesseract`, `tesseract-auto`, `marker`,
`claude` and `auto-local`. Multi-page TIFF is read in full — Pillow opens such
`claude`, `claude-haiku` and `auto-local`. Multi-page TIFF is read in full — Pillow opens such
a file at frame 0 and says nothing about the rest, so backends that cannot page
through one refuse it by name rather than returning the cover as though it were
the whole document.
Expand Down
6 changes: 5 additions & 1 deletion docs/guide/backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ strategy built on top of them.
| `paddle-vl` | `[paddle-vl]` | ✓ | Document vision-language model. Reads PDFs and multi-page TIFFs; strongest local engine measured, but minutes per page |
| `marker` | `[marker]` | ✓ | Layout-aware document conversion, the only local backend that models reading order |
| `claude` | `[claude]` | ✓ | The Anthropic vision API. Reads material no local tool can |
| `claude-haiku` | `[claude]` | ✓ | The same API with Anthropic's smallest current model. Cheaper, and measurably worse on the material `claude` is for |
| `auto-local` | `[qa]` | ✓ | **The recommended default.** Runs the viable local engines, scores each, keeps the best |

The measurements behind every claim on this page are on
Expand Down Expand Up @@ -44,6 +45,9 @@ deliberately not repeated here, where nothing would keep them current.
between runs: it recovers the same words and orders them differently. It
is the thing to reach for on decorative and hand-lettered type, where
local engines collapse.
- **`claude-haiku` is not a cheaper `claude`.** On the posters local
engines cannot read, it leaves out imprints and small lines and sometimes
puts plausible wording in their place. Use `claude` for escalation.
- **The deep-learning backends download weights on first run** and hold them
in memory afterwards, so the first call is slow and later ones are not.
That is fine for batch work and poor for one-shot interactive use.
Expand Down Expand Up @@ -91,7 +95,7 @@ instead.
## Supported files

JPEG, PNG and TIFF everywhere; PDF on `tesseract`, `tesseract-auto`,
`paddle-vl`, `marker`, `claude` and `auto-local`. The batch pipeline filters
`paddle-vl`, `marker`, `claude`, `claude-haiku` and `auto-local`. The batch pipeline filters
`workspace/scans/` by the chosen backend's supported extensions, so a PDF is
silently skipped under `easyocr`, `easyocr-hy`, `paddle` or `vision`;
`--dry-run` makes that visible.
Expand Down
1 change: 1 addition & 0 deletions docs/guide/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $ tetrak-ocr backends
✓ tesseract
✓ tesseract-auto
· claude (extra not installed)
· claude-haiku (extra not installed)
✓ auto-local
```

Expand Down
3 changes: 2 additions & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ well over a gigabyte before any model downloads at first run.
| `paddle-vl` | `paddle-vl` | PaddleOCR-VL, the document vision-language model in the same package |
| `marker` | `marker` | marker-pdf 1.x |
| `vision` | `vision` | `ocrmac`, a wrapper over Apple's Vision framework. macOS only |
| `claude` | `claude` | the Anthropic SDK |
| `claude` | `claude`, `claude-haiku` | the Anthropic SDK |
| `ocr` | everything above except `armenian` | |
| `all` | the same as `ocr` | |

Expand Down Expand Up @@ -116,6 +116,7 @@ $ tetrak-ocr backends
✓ tesseract
✓ tesseract-auto
· claude (extra not installed)
· claude-haiku (extra not installed)
· easyocr (extra not installed)
✓ easyocr-hy
· paddle (extra not installed)
Expand Down
38 changes: 19 additions & 19 deletions evaluation/ocr/benchmark.csv
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
fixture,tesseract_chr,tesseract_wrd,tesseract_sec,tesseract-auto_chr,tesseract-auto_wrd,tesseract-auto_sec,claude_chr,claude_wrd,claude_sec,easyocr_chr,easyocr_wrd,easyocr_sec,easyocr-hy_chr,easyocr-hy_wrd,easyocr-hy_sec,paddle_chr,paddle_wrd,paddle_sec,paddle-vl_chr,paddle-vl_wrd,paddle-vl_sec,marker_chr,marker_wrd,marker_sec,vision_chr,vision_wrd,vision_sec,auto-local_chr,auto-local_wrd,auto-local_sec
bancroft-magician-poster.jpg,0.0723,0.0000,0.46,0.2846,0.0000,0.34,0.7165,0.7727,3.92,0.3970,0.1364,3.00,0.1750,0.0000,3.95,0.5467,0.3182,10.86,0.3084,0.1364,23.14,0.1658,0.0000,8.94,0.5692,0.4091,0.95,0.5692,0.4091,15.13
carthay-circle-postcard-back.png,0.5950,0.5000,0.43,0.9256,0.7917,0.48,0.9766,0.9167,6.21,0.7860,0.6250,0.41,0.4874,0.0833,0.42,0.2844,0.6250,7.23,0.6780,0.7917,21.24,0.6640,0.6250,5.65,0.6535,0.8333,0.55,0.9256,0.7917,16.79
carthay-circle-premiere.jpg,0.0000,0.0000,0.20,0.5141,0.8571,0.47,0.8939,0.9286,2.39,0.8701,0.7143,0.35,0.7444,0.2857,0.27,0.0885,0.0000,6.79,0.8827,0.8571,18.12,0.7562,0.8571,5.60,0.8939,0.9286,0.47,0.5141,0.8571,15.29
chinese-theatre-triptych-postcard.jpg,0.4444,0.4000,0.30,0.4444,0.4000,0.32,1.0000,1.0000,2.19,0.5044,0.6667,0.29,0.4622,0.0000,0.35,0.7850,0.7333,6.03,0.8290,0.8667,13.71,0.4472,0.4667,4.38,0.6578,0.9333,0.50,0.4472,0.4667,13.16
graumans-chinese-theatre.jpg,0.6587,0.4375,0.27,0.7933,0.4375,0.28,0.8750,0.5625,2.41,0.7168,0.5000,0.31,0.6092,0.0625,0.31,0.7386,0.1875,6.30,0.7179,0.3125,16.61,0.0960,0.0000,5.39,0.7342,0.3750,0.46,0.7342,0.3750,13.52
greek-theatre-night.jpg,0.9048,0.7500,0.27,0.9048,0.7500,0.29,1.0000,1.0000,2.37,0.9486,0.7500,0.30,0.7907,0.0000,0.28,0.9114,0.5000,4.32,0.9882,0.9167,15.11,0.7387,1.0000,5.39,0.9829,1.0000,0.46,0.7387,1.0000,12.34
hollywood-boulevard-east.jpg,0.6311,0.3333,0.30,0.6184,0.3333,0.31,0.9286,0.8333,2.76,0.7240,0.4444,0.28,0.6484,0.1667,0.28,0.6352,0.4444,7.42,0.6537,0.3889,10.97,0.1111,0.0000,5.56,0.6825,0.3889,0.54,0.6825,0.3889,15.46
hollywood-boulevard-west.jpg,0.4161,0.2667,0.28,0.4161,0.2667,0.29,0.9577,0.8333,3.55,0.5660,0.3000,0.30,0.4177,0.1667,0.35,0.5759,0.4333,6.40,0.4949,0.2667,17.93,0.0806,0.0000,6.81,0.5333,0.4333,0.50,0.4161,0.2667,14.76
hollywood-music-box-playbill-1926.tif,0.5181,0.4569,1.04,0.5699,0.5310,1.11,0.9914,0.9603,28.12,0.5032,0.3948,5.70,0.3408,0.2569,7.85,0.7777,0.9086,42.61,0.8751,0.9000,170.32,0.4715,0.7362,274.70,0.6890,0.8103,1.20,0.4715,0.7362,325.30
inside-facts-1930-cover.jpg,0.6824,0.8489,2.21,0.8966,0.9064,2.16,0.9970,0.9932,27.20,0.4130,0.7080,7.82,0.6490,0.5039,9.72,0.5009,0.9414,57.51,0.9798,0.9335,221.11,0.7511,0.8997,286.81,0.6320,0.8771,2.25,0.7511,0.8997,349.55
inside-facts-1930-page-six.jpg,0.9409,0.9060,4.86,0.9409,0.9060,4.88,0.9941,0.9517,63.99,0.3013,0.7778,17.70,0.6093,0.6038,21.47,0.2953,0.9693,132.41,0.9620,0.9462,612.47,0.7382,0.9301,308.03,0.5942,0.8914,4.17,0.7382,0.9301,461.41
kar-mi-troupe-poster.jpg,0.0143,0.0048,0.30,0.0890,0.0145,0.39,0.9872,0.9758,11.16,0.1239,0.3913,0.71,0.0967,0.0000,1.04,0.2741,0.3816,9.22,0.2874,0.4396,27.04,0.0264,0.0000,2.91,0.2857,0.4638,0.82,0.2857,0.4638,16.80
kinema-theater-ad-1920.tif,0.4506,0.3983,0.77,0.4506,0.3983,0.81,0.7537,0.9788,17.32,0.4175,0.6653,2.73,0.4324,0.3263,3.80,0.4907,0.9280,26.28,0.7429,0.9195,126.50,0.9319,0.8686,23.24,0.8837,0.9068,1.14,0.9319,0.8686,58.29
king-of-kings-souvenir-1927.pdf,0.9120,0.9443,35.50,0.9120,0.9443,35.24,0.9309,0.9664,150.72,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0.8921,0.9007,1128.65,0.8703,0.9239,423.31,N/A,N/A,N/A,0.8703,0.9239,431.60
over-the-fence-poster.jpg,0.1863,0.1364,0.33,0.3959,0.1818,0.31,0.7737,0.8182,2.97,0.4896,0.2273,0.26,0.2737,0.1364,0.33,0.6355,0.4545,6.48,0.3877,0.3636,14.65,0.1868,0.0000,3.17,0.5373,0.4545,0.62,0.6355,0.4545,12.89
parlor-match-poster.jpg,0.0000,0.0000,0.36,0.1415,0.0312,0.30,1.0000,1.0000,3.45,0.6687,0.4375,0.40,0.2405,0.0000,0.58,0.6806,0.3125,7.88,0.8827,0.7188,25.74,0.7560,0.7500,7.04,0.7872,0.6562,0.80,0.7872,0.6562,19.29
thurston-magician-poster.jpg,0.0833,0.0370,0.29,0.2555,0.2593,0.34,0.9884,0.9630,3.20,0.7353,0.5185,0.26,0.1250,0.0000,0.38,0.7372,0.4444,6.30,0.7310,0.6296,18.05,0.7159,0.5185,6.37,0.6237,0.5185,0.63,0.7159,0.5185,19.40
Average,0.4418,0.3777,48.17,0.5620,0.4711,48.32,0.9273,0.9091,333.93,0.5728,0.5161,40.82,0.4439,0.1620,51.36,0.5599,0.5364,344.02,0.7231,0.6640,2481.36,0.5005,0.5045,1383.30,0.6712,0.6800,16.05,0.6597,0.6475,1811.01
fixture,tesseract_chr,tesseract_wrd,tesseract_sec,tesseract-auto_chr,tesseract-auto_wrd,tesseract-auto_sec,claude_chr,claude_wrd,claude_sec,claude-haiku_chr,claude-haiku_wrd,claude-haiku_sec,easyocr_chr,easyocr_wrd,easyocr_sec,easyocr-hy_chr,easyocr-hy_wrd,easyocr-hy_sec,paddle_chr,paddle_wrd,paddle_sec,paddle-vl_chr,paddle-vl_wrd,paddle-vl_sec,marker_chr,marker_wrd,marker_sec,vision_chr,vision_wrd,vision_sec,auto-local_chr,auto-local_wrd,auto-local_sec
bancroft-magician-poster.jpg,0.0723,0.0000,0.46,0.2846,0.0000,0.34,0.7165,0.7727,3.92,0.5759,0.6364,2.29,0.3970,0.1364,3.00,0.1750,0.0000,3.95,0.5467,0.3182,10.86,0.3084,0.1364,23.14,0.1658,0.0000,8.94,0.5692,0.4091,0.95,0.5692,0.4091,15.13
carthay-circle-postcard-back.png,0.5950,0.5000,0.43,0.9256,0.7917,0.48,0.9766,0.9167,6.21,0.9728,0.9167,3.05,0.7860,0.6250,0.41,0.4874,0.0833,0.42,0.2844,0.6250,7.23,0.6780,0.7917,21.24,0.6640,0.6250,5.65,0.6535,0.8333,0.55,0.9256,0.7917,16.79
carthay-circle-premiere.jpg,0.0000,0.0000,0.20,0.5141,0.8571,0.47,0.8939,0.9286,2.39,0.8939,0.9286,1.67,0.8701,0.7143,0.35,0.7444,0.2857,0.27,0.0885,0.0000,6.79,0.8827,0.8571,18.12,0.7562,0.8571,5.60,0.8939,0.9286,0.47,0.5141,0.8571,15.29
chinese-theatre-triptych-postcard.jpg,0.4444,0.4000,0.30,0.4444,0.4000,0.32,1.0000,1.0000,2.19,0.9469,1.0000,1.56,0.5044,0.6667,0.29,0.4622,0.0000,0.35,0.7850,0.7333,6.03,0.8290,0.8667,13.71,0.4472,0.4667,4.38,0.6578,0.9333,0.50,0.4472,0.4667,13.16
graumans-chinese-theatre.jpg,0.6587,0.4375,0.27,0.7933,0.4375,0.28,0.8750,0.5625,2.41,0.8333,0.6250,3.02,0.7168,0.5000,0.31,0.6092,0.0625,0.31,0.7386,0.1875,6.30,0.7179,0.3125,16.61,0.0960,0.0000,5.39,0.7342,0.3750,0.46,0.7342,0.3750,13.52
greek-theatre-night.jpg,0.9048,0.7500,0.27,0.9048,0.7500,0.29,1.0000,1.0000,2.37,1.0000,1.0000,1.85,0.9486,0.7500,0.30,0.7907,0.0000,0.28,0.9114,0.5000,4.32,0.9882,0.9167,15.11,0.7387,1.0000,5.39,0.9829,1.0000,0.46,0.7387,1.0000,12.34
hollywood-boulevard-east.jpg,0.6311,0.3333,0.30,0.6184,0.3333,0.31,0.9286,0.8333,2.76,0.7328,0.6111,2.19,0.7240,0.4444,0.28,0.6484,0.1667,0.28,0.6352,0.4444,7.42,0.6537,0.3889,10.97,0.1111,0.0000,5.56,0.6825,0.3889,0.54,0.6825,0.3889,15.46
hollywood-boulevard-west.jpg,0.4161,0.2667,0.28,0.4161,0.2667,0.29,0.9577,0.8333,3.55,0.7989,0.6333,4.43,0.5660,0.3000,0.30,0.4177,0.1667,0.35,0.5759,0.4333,6.40,0.4949,0.2667,17.93,0.0806,0.0000,6.81,0.5333,0.4333,0.50,0.4161,0.2667,14.76
hollywood-music-box-playbill-1926.tif,0.5181,0.4569,1.04,0.5699,0.5310,1.11,0.9914,0.9603,28.12,0.9763,0.9431,8.68,0.5032,0.3948,5.70,0.3408,0.2569,7.85,0.7777,0.9086,42.61,0.8751,0.9000,170.32,0.4715,0.7362,274.70,0.6890,0.8103,1.20,0.4715,0.7362,325.30
inside-facts-1930-cover.jpg,0.6824,0.8489,2.21,0.8966,0.9064,2.16,0.9970,0.9932,27.20,0.9736,0.9402,6.61,0.4130,0.7080,7.82,0.6490,0.5039,9.72,0.5009,0.9414,57.51,0.9798,0.9335,221.11,0.7511,0.8997,286.81,0.6320,0.8771,2.25,0.7511,0.8997,349.55
inside-facts-1930-page-six.jpg,0.9409,0.9060,4.86,0.9409,0.9060,4.88,0.9941,0.9517,63.99,0.5926,0.9452,17.32,0.3013,0.7778,17.70,0.6093,0.6038,21.47,0.2953,0.9693,132.41,0.9620,0.9462,612.47,0.7382,0.9301,308.03,0.5942,0.8914,4.17,0.7382,0.9301,461.41
kar-mi-troupe-poster.jpg,0.0143,0.0048,0.30,0.0890,0.0145,0.39,0.9872,0.9758,11.16,0.8287,0.8792,4.28,0.1239,0.3913,0.71,0.0967,0.0000,1.04,0.2741,0.3816,9.22,0.2874,0.4396,27.04,0.0264,0.0000,2.91,0.2857,0.4638,0.82,0.2857,0.4638,16.80
kinema-theater-ad-1920.tif,0.4506,0.3983,0.77,0.4506,0.3983,0.81,0.7537,0.9788,17.32,0.9847,0.9661,9.75,0.4175,0.6653,2.73,0.4324,0.3263,3.80,0.4907,0.9280,26.28,0.7429,0.9195,126.50,0.9319,0.8686,23.24,0.8837,0.9068,1.14,0.9319,0.8686,58.29
king-of-kings-souvenir-1927.pdf,0.9120,0.9443,35.50,0.9120,0.9443,35.24,0.9309,0.9664,150.72,0.8858,0.9411,46.95,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0.8921,0.9007,1128.65,0.8703,0.9239,423.31,N/A,N/A,N/A,0.8703,0.9239,431.60
over-the-fence-poster.jpg,0.1863,0.1364,0.33,0.3959,0.1818,0.31,0.7737,0.8182,2.97,0.9517,0.8182,3.37,0.4896,0.2273,0.26,0.2737,0.1364,0.33,0.6355,0.4545,6.48,0.3877,0.3636,14.65,0.1868,0.0000,3.17,0.5373,0.4545,0.62,0.6355,0.4545,12.89
parlor-match-poster.jpg,0.0000,0.0000,0.36,0.1415,0.0312,0.30,1.0000,1.0000,3.45,0.9796,0.8750,1.95,0.6687,0.4375,0.40,0.2405,0.0000,0.58,0.6806,0.3125,7.88,0.8827,0.7188,25.74,0.7560,0.7500,7.04,0.7872,0.6562,0.80,0.7872,0.6562,19.29
thurston-magician-poster.jpg,0.0833,0.0370,0.29,0.2555,0.2593,0.34,0.9884,0.9630,3.20,0.7626,0.6296,3.26,0.7353,0.5185,0.26,0.1250,0.0000,0.38,0.7372,0.4444,6.30,0.7310,0.6296,18.05,0.7159,0.5185,6.37,0.6237,0.5185,0.63,0.7159,0.5185,19.40
Average,0.4418,0.3777,48.17,0.5620,0.4711,48.32,0.9273,0.9091,333.93,0.8641,0.8405,122.25,0.5728,0.5161,40.82,0.4439,0.1620,51.36,0.5599,0.5364,344.02,0.7231,0.6640,2481.36,0.5005,0.5045,1383.30,0.6712,0.6800,16.05,0.6597,0.6475,1811.01
Loading
Loading