#2323rd of 33 in Data and scraping for AIFor data and documents, documents and ocr
doctr
Two-stage OCR library for PDFs and images, built on PyTorch
- Stars
- 6.4k
- License
- Apache-2.0
- Last commit
- Oct 2026
- Last release
- Aug 2026
- Language
- Python
5,946 on 4 Apr 20266,405 on 31 Oct 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
docTR is a Python library that extracts text from PDFs and images by running a text detection model, then a text recognition model on each detected word. It returns a structured Document (pages, blocks, lines, words) that can be exported as JSON, and also offers a KIE predictor, optional layout detection and a FastAPI template. Detection and recognition architectures are selectable, with pretrained weights.
Who it is for: Developers adding self-hosted OCR to document pipelines in Python
Strengths
- Swappable detection (DBNet, LinkNet, FAST) and recognition (CRNN, SAR, MASTER, ViTSTR, PARSeq, VIPTR) models
- Handles rotated pages and returns nested page/block/line/word output exportable to JSON
- Includes KIE predictor, layout detection and a FastAPI template with OCR and KIE routes
- Hosted Hugging Face Space and Streamlit demo for trying it before installing
Weaknesses
- Python 3.11 or higher required; PyTorch is the only supported framework
- API template is minimal; README example uses port 8080 while the server runs on 8002
- Docker GPU images need host CUDA 12.2 or newer
- Default pipeline is OCR only; table structure and layout models are listed but sparsely documented in README
What it needs
- GPU optional
- Docker
- Needs PyTorch, Streamlit (demo), FastAPI (API template), weasyprint (URL input)
- Models: DBNet, LinkNet, FAST, CRNN, SAR
- port 8002
Quick answers
Is doctr open source?
Yes. Its code is on GitHub under the Apache-2.0 license.
Can you run doctr with Docker?
Yes. Its repository has a Docker setup: a Dockerfile, a Compose file or a published image.
Does doctr need a GPU?
No. It runs on a CPU and can use a GPU when you have one.
Also in Data and scraping for AI
See all 33| Rank | Project | Score |
|---|---|---|
| 1 | mineruDocument parser that converts PDFs, images and Office files to Markdown and JSON | 94 out of 100 |
| 2 | doclingPython library and CLI that converts PDFs, Office files and more into structured text | 91 out of 100 |
| 3 | opendataloader-pdfPDF parser that outputs Markdown, JSON with bounding boxes, and Tagged PDF | 87 out of 100 |
| #4 | markitdownPython library and CLI that converts office files, PDFs and audio to Markdown | 86 out of 100 |
| #5 | agent-reachCLI that gives coding agents read access to login-gated and Chinese web platforms | 85 out of 100 |