--- id: python-doctr version: "1.0.1" license: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) license_treatment: permissive maintenance: active --- # python-doctr — Document Text Recognition (docTR): deep Learning for high-performance OCR on documents. License: permissive · Maintenance: active · Downloads: 340.7K/mo ## What it is and what it does python-doctr is a PyTorch-based OCR library that combines text detection and recognition models to extract structured text from documents. It reads PDFs and images, localizes each word, recognizes its characters, and returns a nested document structure (Page, Block, Line, Word) that can be exported as JSON or visualized. The library offers multiple architectures for both detection (DBNet, LinkNet, FAST) and recognition (CRNN, SAR, MASTER, ViTSTR, PARSeq, VIPTR), letting you choose speed versus accuracy trade-offs. The package handles rotated pages and multi-orientation text through configurable options, supports a KIE (Key Information Extraction) predictor for multi-class detection, and includes utilities for document synthesis and interactive result visualization. It integrates with Hugging Face Hub for model distribution and includes a Streamlit demo app for local testing. Use it for: - Extract text and bounding boxes from scanned invoices, receipts, or forms for downstream processing. - Build a document search index by OCR-ing a large PDF archive and exporting structured text. - Detect and extract specific fields (dates, addresses) from documents using the KIE predictor with a custom multi-class detector. - Automate data entry workflows by recognizing and localizing text in handwritten or printed documents. - Validate or correct OCR output by visualizing detected text regions and character predictions interactively. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. python-doctr extracts and localizes text from documents and images using a two-stage deep learning pipeline: text detection (finding word locations) followed by text recognition (identifying characters), with support for PDFs, images, and rotated pages. Yes, if you need production-grade OCR with flexible model selection and don't mind the weight of torch and torchvision. The library is actively maintained, permissively licensed, and well-documented. Install only if you have a genuine OCR task; the dependency footprint is substantial but justified for deep learning work. ## Install pip install python-doctr uv add python-doctr poetry add python-doctr ## Installing python-doctr Before you install: Low install friction with a pure-Python wheel. Requires 18 runtime dependencies including torch, torchvision, and opencv-python, which are substantial but standard for deep learning work. Repository is active with recent commits and 6258 stars, indicating ongoing maintenance. License in practice: Apache License 2.0 is permissive: you can use, modify, and distribute python-doctr freely in commercial and private projects, provided you include a copy of the license and note any changes you make. Quickstart: pip install python-doctr from doctr.models import ocr_predictor from doctr.io import DocumentFile model = ocr_predictor(pretrained=True) doc = DocumentFile.from_pdf("path/to/doc.pdf") result = model(doc) json_output = result.export() Requires Python 3.10 or higher. torch and torchvision are heavy dependencies; GPU support is optional but recommended for performance. Verify before relying: - Inference speed and accuracy benchmarks on common document types and languages. - Memory footprint and whether models can run on resource-constrained environments. - How well the KIE predictor generalizes to custom document classes beyond the examples shown. ## Package facts - License: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 340.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags OCR text extraction, document text recognition, text detection and recognition, PDF text extraction, deep learning OCR, PyTorch OCR, document image analysis, ocr, document-processing, computer-vision [View on SkillFed](https://skillfed.io/packages/python-doctr) · [View on PyPI](https://pypi.org/project/python-doctr/)