tinydoc-5m / README.md
harryfrz's picture
Model card metadata (Apache-2.0, image-to-text, datasets, evaluation results); banner without the measurement note
d9afd9b verified
|
Raw History Blame Contribute Delete
3.13 kB
metadata
license: apache-2.0
language:
  - en
pipeline_tag: image-to-text
library_name: onnx
tags:
  - ocr
  - document-understanding
  - document-parsing
  - key-information-extraction
  - receipts
  - invoices
  - pdf
  - onnx
  - cpu
datasets:
  - naver-clova-ix/cord-v2
  - docling-project/DocLayNet-v1.2
metrics:
  - cer
model-index:
  - name: tinydoc
    results:
      - task:
          type: image-to-text
          name: OCR
        dataset:
          name: OmniDocBench v1.5, English pages
          type: opendatalab/OmniDocBench
        metrics:
          - type: edit_distance
            value: 0.117
            name: Text edit distance, page average (lower is better)
      - task:
          type: image-to-text
          name: Text-line recognition
        dataset:
          name: CORD-v2 receipt lines
          type: naver-clova-ix/cord-v2
          split: test
        metrics:
          - type: cer
            value: 1.23
            name: Character error rate, % (lower is better)
      - task:
          type: image-to-text
          name: Text-line recognition
        dataset:
          name: DocLayNet v1.2 lines
          type: docling-project/DocLayNet-v1.2
          split: test
        metrics:
          - type: cer
            value: 8.94
            name: Character error rate, % (lower is better)

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.