# mindee/doctr

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/mindee-doctr).**

6,149 stars · 649 forks · Python · Apache-2.0

## Links

- GitHub: https://github.com/mindee/doctr
- Homepage: https://mindee.github.io/doctr/
- awesome-repositories: https://awesome-repositories.com/repository/mindee-doctr.md

## Topics

`deep-learning` `document-recognition` `ocr` `optical-character-recognition` `pytorch` `tensorflow2` `text-detection` `text-detection-recognition` `text-recognition`

## Description

DocTR is a deep learning OCR library built on PyTorch that detects and transcribes text in document images using a two-stage detection-recognition pipeline. It provides a complete framework for building and deploying OCR pipelines with pretrained models available through the Hugging Face Hub, and supports exporting trained models to ONNX format for cross-runtime deployment.

The library offers end-to-end OCR pipelines that combine text detection and recognition to extract all text from document images or PDFs, with support for rotated page handling and varied text orientations. It includes capabilities for document layout analysis using transformer-based detectors, key information extraction that combines detection, recognition, and layout analysis to extract structured data, and document image classification using standard CNN architectures. Text detection is performed using segmentation-based detectors like DBNet and LinkNet, while text recognition uses sequence recognition models such as CRNN, SAR, and MASTER, with optional vocabulary restriction for character set control.

DocTR provides multiple deployment options including FastAPI-based REST API serving for remote document processing, command-line tools for script-based analysis, and Docker container deployment for consistent environments. It supports document input from images, PDFs, and URLs through a unified loading interface, and offers post-processing capabilities including prediction visualization, document reconstruction, and structured JSON export. The library also includes model benchmarking tools for comparing custom architectures against pretrained models on standard datasets.

## Tags

### Artificial Intelligence & ML

- [OCR Libraries](https://awesome-repositories.com/f/artificial-intelligence-ml/deep-learning-libraries/ocr-libraries.md) — Ships a complete deep learning OCR library with pretrained detection and recognition models on PyTorch.
- [End-to-End Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/chinese-ocr-tools/end-to-end-pipelines.md) — Combines detection and recognition models into a complete end-to-end OCR pipeline. ([source](https://mindee.github.io/doctr/))
- [PyTorch-Based Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/deep-learning-frameworks/pytorch-based-frameworks.md) — All models are built and trained using PyTorch with GPU acceleration.
- [OCR Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/deep-learning-frameworks/pytorch-based-frameworks/ocr-frameworks.md) — Provides a complete PyTorch-based framework for building and deploying OCR pipelines with pretrained models.
- [Detection Result Exporters](https://awesome-repositories.com/f/artificial-intelligence-ml/bounding-box-detection/detection-result-exporters.md) — Provides visualization of detected text overlays and exports OCR predictions as structured JSON. ([source](https://cdn.jsdelivr.net/gh/mindee/doctr@main/README.md))
- [Rotated Detections](https://awesome-repositories.com/f/artificial-intelligence-ml/computer-vision-systems/computer-vision/object-detection-tracking/object-detection/rotated-detections.md) — Detects and returns rotated bounding boxes for text to accommodate varied page orientations. ([source](https://cdn.jsdelivr.net/gh/mindee/doctr@main/README.md))
- [Document Information Extraction](https://awesome-repositories.com/f/artificial-intelligence-ml/document-information-extraction.md) — Performs end-to-end key information extraction by combining detection, recognition, and layout analysis on document images. ([source](https://mindee.github.io/doctr/latest//modules/models.html))
- [ONNX Model Exporters](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-deployment-and-serving/serialization-and-export-formats/onnx-model-exporters.md) — Converts trained PyTorch models into the ONNX interchange format for deployment in non-PyTorch environments. ([source](https://mindee.github.io/doctr/latest/modules/models.html))
- [ONNX Exporters](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-inference-serving/inference-engines/onnx-runtime-inference/ocr-pipelines/onnx-exporters.md) — Supports exporting trained OCR models to ONNX format for cross-runtime deployment.
- [Document Layout](https://awesome-repositories.com/f/artificial-intelligence-ml/model-predictions/prediction-engines/document-layout.md) — Identifies structural regions like paragraphs, tables, and figures using a transformer-based detector. ([source](https://mindee.github.io/doctr/latest/modules/models.html))
- [Tree Representations](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-processing/structured-document-extraction/tree-representations.md) — Structures detected text into a hierarchy of words, lines, blocks, pages, and documents. ([source](https://mindee.github.io/doctr/modules/io.html))
- [Document Region Detectors](https://awesome-repositories.com/f/artificial-intelligence-ml/region-based-detection/document-region-detectors.md) — Detects structural regions with transformer-based detectors supporting straight or rotated bounding boxes. ([source](https://mindee.github.io/doctr/latest/modules/models.html))

### Part of an Awesome List

- [Segmentation-Based Detectors](https://awesome-repositories.com/f/awesome-lists/ai/text-detection/segmentation-based-detectors.md) — Locates text regions in document images using segmentation-based detectors like DBNet and LinkNet with various backbones. ([source](https://cdn.jsdelivr.net/gh/mindee/doctr@main/README.md))
- [Text Recognition](https://awesome-repositories.com/f/awesome-lists/ai/text-recognition.md) — Transcribes characters in cropped text regions into strings using a choice of pretrained recognition models. ([source](https://mindee.github.io/doctr))
- [Document Text Recognition Toolkits](https://awesome-repositories.com/f/awesome-lists/ai/text-recognition/document-text-recognition-toolkits.md) — Provides a full toolkit for extracting text from scanned documents using trainable detection and recognition models.
- [Two-Stage Pipelines](https://awesome-repositories.com/f/awesome-lists/ai/text-recognition/modular-detection-and-recognition/two-stage-pipelines.md) — Implements a two-stage pipeline that first detects text regions then transcribes each one.
- [Computer Vision](https://awesome-repositories.com/f/awesome-lists/ai/computer-vision.md) — High-performance document text recognition and analysis.

### Content Management & Publishing

- [PDF Document Importers](https://awesome-repositories.com/f/content-management-publishing/pdf-document-importers.md) — Reads PDFs from file paths, byte streams, or URLs and decodes each page into a numpy array. ([source](https://mindee.github.io/doctr/modules/io.html))

### Data & Databases

- [Document Entity Extractors](https://awesome-repositories.com/f/data-databases/link-metadata-extraction/entity-extraction/document-entity-extractors.md) — Extracts structured entities such as dates and addresses from document images using combined detection and recognition. ([source](https://cdn.jsdelivr.net/gh/mindee/doctr@main/README.md))

### Development Tools & Productivity

- [OCR REST API Servers](https://awesome-repositories.com/f/development-tools-productivity/rest-api-integrations/ocr-rest-api-servers.md) — Ships a FastAPI-based REST endpoint that accepts documents and returns OCR results. ([source](https://cdn.jsdelivr.net/gh/mindee/doctr@main/README.md))

### DevOps & Infrastructure

- [OCR Deployments](https://awesome-repositories.com/f/devops-infrastructure/cross-platform-deployment-targets/ocr-deployments.md) — Integrates the detection-recognition predictor into browser demos or API endpoints with minimal setup. ([source](https://mindee.github.io/doctr))
- [OCR Model Hubs](https://awesome-repositories.com/f/devops-infrastructure/model-conversion/hugging-face/ocr-model-hubs.md) — Loads pretrained OCR model checkpoints directly from the Hugging Face Hub for immediate use.

### Graphics & Multimedia

- [Transformer-Based Detectors](https://awesome-repositories.com/f/graphics-multimedia/document-layout-analysis/transformer-based-detectors.md) — Uses transformer-based detectors for identifying structural regions in document layout analysis.
