wycliffeassociates/docscanner-ocr
DocScanner on-device OCR models
ONNX exports of PaddleOCR text detection and recognition models, used by DocScanner to transcribe handwritten pages entirely on the device.
DocScanner is a free, open-source tool for Bible translation field teams. Transcription has to work without a network and without per-page cost, so no cloud model is involved: a page is cut into text lines by the detector, and each line is read by the recognizer for that project's writing system.
Layout
A device downloads the detector plus exactly one recognizer — 13 MB for most scripts, 78 MB for Latin/CJK — never the whole set.
The app pins a tag of this repository in its download URL, so a given build can only ever fetch the weights it was tested against.
Provenance
Exported with `paddle2onnx` from the official PaddleOCR inference models, unquantized (float32):
charset.json is each model's character table from PaddleOCR, as a JSON array. The recognizer output has charset + 2 classes: index 0 is the CTC blank, then the table, then a space — the layout PaddleOCR's CTCLabelDecode expects.
Interfaces
Detector (det_model.onnx) — input [1, 3, H, W], BGR, long side scaled to 960 and floored to a multiple of 32, normalized with ImageNet statistics (mean 0.485/0.456/0.406, std 0.229/0.224/0.225). Output [1, 1, H, W], a per-pixel probability of text.
Recognizers (rec_model.onnx) — input [1, 3, 48, W], RGB, height 48 with width scaled by the line's aspect ratio and padded to a multiple of 32, normalized (x/255 - 0.5) / 0.5. Padding is left at zero after normalization (mid-grey), which is how PaddleOCR pads; padding with black instead wrecks recognition. Output [1, T, classes] logits, greedy CTC decoded.
Arabic is read right-to-left: CTC scans left to right and so emits the logically last character first. The line is reversed by grapheme cluster, keeping combining marks attached to their base letter — correcting this took the error on rendered Arabic from 79% to 18%.
Measured accuracy
Character error rate on handwritten sample pages, per line, after detection:
These are CTC models with no language model, which is deliberate: an unreadable crop comes back garbled or empty rather than as fluent invented text. A TrOCR alternative scored better on neat English (2%) but rewrote what it could not read — including inventing liturgical Church Slavonic from a blank strip — which is the wrong failure mode for a translation tool.
Not included
- Cyrillic — PaddleOCR's Cyrillic recognizers manage only 76-84% CER on handwriting, so those projects use server transcription until a model trained on handwritten lines exists.
- Hebrew — no PaddleOCR model.
- Greek — not yet wired.
License
Apache-2.0, inherited from PaddleOCR. Please keep the attribution to the PaddleOCR project.
