DocTR
PyTorch OCR library pairing text detection and recognition models, now with layout and table parsing.
About
Mindee created this Python library, and the German company t2k GmbH now leads its development. It reads documents in two passes, with a detection network finding word boxes and a recognition network then decoding the characters inside each one. You can pair detectors such as DBNet, LinkNet and FAST with recognizers including CRNN, SAR, MASTER, ViTSTR, PARSeq and VIPTR, all with pretrained weights, and it handles rotated pages and skewed boxes. Input can be PDFs, image files or rendered web pages, and results arrive as a nested tree of pages, blocks, lines and words that exports to JSON. Version 1.1.0, from August 2026, added layout detection, table structure recognition, reading-order export to Markdown, HTML, AsciiDoc and XML, character whitelisting and a doctr-cli command. Since 1.0 the only backend is PyTorch; install with pip install python-doctr on Python 3.11 or newer. A Streamlit demo, a FastAPI template and CUDA-based Docker images come with it. Apache 2.0 licensed and fine for commercial use, it suits developers who want self-hosted OCR they can retrain on their own documents.
Should you use DocTR?
Pick it when
Choose docTR when you want an Apache-2.0, PyTorch-based OCR library with separate detection and recognition models you can swap or fine-tune, word positions in the output, and both document scans and natural images to read.
Look elsewhere when
Skip it if you need full document conversion with tables, layout, and Markdown output: Docling or PaddleOCR's PP-StructureV3 cover that. For a three-line API with 80+ documented languages, EasyOCR is quicker to start.
Alternatives to DocTR
- EasyOCR
Simpler three-line API with 80+ documented languages, but less control over swapping and retraining the separate detection and recognition stages.
- PaddleOCR
Adds layout, table, and formula recognition plus mobile-size models, at the cost of adopting the PaddlePaddle framework instead of the PyTorch stack docTR uses.
- Tesseract
CPU engine with 100+ languages and no Python ML framework to install, but aimed at document text lines rather than the natural images docTR also handles.
- Surya OCR
Adds layout, reading order, and table recognition in 90+ languages, but runs its VLM through a vLLM or llama.cpp server, and its weights carry a commercial-use threshold.
Reviews (0)
Leave a Review
No reviews yet. Be the first to review!
Details
- Category
- OCR & Document Processing
- Price
- Free
- Platform
- Local/Desktop
- Difficulty
- Easy (2/5)
- License
- Apache-2.0
- Added
- Apr 3, 2026