Runs in your browser. Your document data is not uploaded or stored.

OCR read log: user involvement when the fallback wins

Scan flow · log · fallback engine · retry · user consent

What the user sees

While the OCR engine ladder runs, the scan UI reports each loading step ("loading MRZ model", "re-downloading MRZ model", "loading fallback engine") so the read is never a silent black box. On the result screen:

  • If the MRZ model read the band, nothing special is shown — it is the expected path.
  • If the stock `eng` fallback engine produced the result, the screen says so explicitly (a warning callout), because `eng` is much weaker on MRZ text (1/66 vs 10/66 valid reads on the fixture benchmark).

The retry

Next to the fallback notice is "Try the MRZ model again". It calls `resetOcrWorker()` (`lib/ocr/shared-worker.ts`), which drops the cached worker, clears the engine state, and terminates the old worker in the background to free its WASM memory. The next read runs the full ladder again from the MRZ model — first cache, then refresh re-download, then `eng` only as last resort.

Design intent

Functionality is maintained on the fallback engine (same whitelist, same PSM 6 parameters, same ranking and repairs), but the user is always told which engine was used and is always offered a path back to the primary model. Nothing falls back silently.

Sources:

  • `components/scan-flow.tsx` — result screen, engine notice, retry
  • `lib/ocr/shared-worker.ts` — `activeOcrEngine`, `resetOcrWorker`
  • `lib/ocr/engine-ladder.ts` — fallback ordering
← Back to blog