docTR vs TrOCR
Pick docTR when you need word-level OCR with coordinates on full pages such as invoices and receipts, because it detects text and returns a page, block, line and word structure. Pick TrOCR when you already have cropped single text-line images, especially English handwriting, because it reports 2.89 CER on IAM with the large model. TrOCR cannot read a full page by itself, so you must add a line detector.
docTRmindee/doctr | TrOCRmicrosoft/trocr | |
|---|---|---|
| Type | Open source | Open source |
| Price | 1 credit / page | 1 credit / page |
| Per 1,000 pages | $1.00 | $1.00 |
| Typical speed | 0.9 s / page | 1.2 s / page |
| Best for | Word-level OCR with positions | Handwritten text lines |
| Inputs | PDF, images | images |
| Languages | Mainly Latin scripts | English |
| Max pages per request | 500 | 100 |
| Tables | No | No |
| Handwriting | No | ✓ Yes |
| Math | No | No |
| Bounding boxes | ✓ Yes | No |
| Confidence | ✓ Yes | No |
| Forms | No | No |
| Multilingual | No | No |
| On OCRRouter | Available | Available |
Prices are what you pay on OCRRouter. Speed is the provider's typical figure, not a benchmark we ran.
Which to choose
Choose docTR if
- You need to read whole pages: docTR runs detection and recognition in two stages and returns a nested page, block, line and word structure with coordinates as JSON.
- You want to choose or train your own models, with a choice of detection and recognition architectures and straight or rotated boxes.
- You want ready Docker images and a demo on Hugging Face Spaces under Apache-2.0, plus a key information extraction predictor for invoices and receipts.
Choose TrOCR if
- You are reading English handwritten lines: the large model reports 2.89 character error rate on the IAM handwriting set, per the paper.
- You want a recognizer to fine-tune on your own line images, with separate checkpoints for handwritten (IAM), printed (SROIE) and scene text.
- You want to load a model in a few lines with Hugging Face transformers under the MIT licence.
Key differences
| docTR | TrOCR | |
|---|---|---|
| What it reads | Full pages: detection plus recognition, output down to word level | Single text-line images only, per the model card; you need a separate line detector |
| Output | JSON with page, block, line and word structure and coordinates; plain text; bounding boxes | Plain text; no layout, table or page-level output |
| Licence | Apache-2.0 | MIT (microsoft/unilm repository) |
| How you run it | Local Python library on PyTorch, with Docker images; GPU images need CUDA 12.2 or newer on the host | Local, through Hugging Face transformers |
| Benchmark | Not published | IAM handwriting CER 2.89 (TrOCR-large), reported by the authors |
| Languages | Not published | Released checkpoints are English-focused; other languages need fine-tuning |
| Known failure | Split-crop merging misjoins readings across repeated characters (issue #2229); cropping images gives poorer results (issue #2007); ONNX export of MASTER truncates decoding steps (issue #2224) | Up to 558M parameters for one text line (base 334M, large 558M), slow versus CRNN recognizers on CPU |
Sources
- docTR GitHub README
- docTR documentation
- Issue #2229
- TrOCR paper (arXiv 2109.10282)
- trocr-large-handwritten model card
- Transformers TrOCR docs
What each one is
docTR
Open-source OCR library from Mindee with separate text detection and recognition models.
docTR detailsTrOCR
Transformer text recognition model. Reads single text lines, including handwriting.
TrOCR detailsTry both on your own file
Run the file once with each model and compare the output.
PDF, PNG, JPG, WebP, HEIC. Up to 20 MB each, 10 files.No file?
Use one, fall back to the other
{"model": "mindee/doctr","fallbacks": ["microsoft/trocr"],"file_url": "https://example.com/document.pdf"}