tinydoc

A small OCR model (5.1M parameters, 20 MB) that reads printed receipts, invoices, PDFs and ordinary pages on a CPU. It returns the text and the key fields (merchant, date, totals, line items) as JSON, with a confidence for every value and a pointer to where on the page it was read.

Benchmarks

tinydoc benchmarks

Measured on an Apple M5 Pro, CPU only, with the same pages and crops for every engine. Indra OCR's figures are the ones Datalab published; Indra was not run here.

Quick start

pip install -r requirements.txt
python -m tinydoc extract receipt.jpg invoice.pdf --backend onnx --weights onnx --out result.json

Every field has a confidence and a needs_review flag. Missing values are null, never guessed. Check validation.needs_review before trusting totals.

Training data

Source Licence
CORD-v2 (Park et al., 2019) CC BY 4.0
WildReceipt (Sun et al., 2021) Apache 2.0
DocLayNet v1.2 subset (Pfitzmann et al., 2022) CDLA-Permissive-1.0
Synthetic receipts, invoices and pages rendered with OFL, Apache and UFL fonts

Trained from scratch: no pretrained weights, and nothing distilled from another model.

Limitations

  • Printed Latin-script text only; no handwriting.
  • Table structure is weak (OmniDocBench TEDS 0.29).
  • With several workers in parallel, Tesseract is slightly faster (3.26 against 3.17 pages per second with 4 workers) and uses far less memory (120 MB against 1.3 GB per worker).
  • Line items and unfamiliar invoice layouts are the least reliable fields.
  • Dense multi-column pages (newspapers, magazines) are the hardest for reading order.

Licence

Apache 2.0 (see LICENSE). The training data keeps its own licences, listed above.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train harryfrz/tinydoc-5m

Evaluation results

  • Text edit distance, page average (lower is better) on OmniDocBench v1.5, English pages
    self-reported
    0.117
  • Character error rate, % (lower is better) on CORD-v2 receipt lines
    test set self-reported
    1.230
  • Character error rate, % (lower is better) on DocLayNet v1.2 lines
    test set self-reported
    8.940