Repolode
mindee

mindee/doctr

An open-source Python OCR library that detects and recognizes text in PDFs and images using deep learning models built on PyTorch.

Open-source alternative to:ABBYY FineReaderAdobe Acrobat OCR

Stars
6,391
Forks
687
Open issues
24
Last commit
2 days ago

What is it?

docTR (Document Text Recognition) is a Python library for optical character recognition. It runs end-to-end OCR in two stages: a text detection model first localizes words on a page, then a text recognition model reads the characters in each word. Inputs can be PDFs, image files, or web pages rendered to documents, and the output is a structured Document object with pages, blocks, lines and words that can be exported as nested JSON.

The library ships with several detection architectures (DBNet, LinkNet, FAST) and recognition architectures (CRNN, SAR, MASTER, ViTSTR, PARSeq, VIPTR), along with pretrained weights. It also offers a key information extraction (KIE) predictor for detecting multiple classes such as dates or addresses, an optional layout detection step, and a table structure recognition model. Rotated pages and text can be handled with straight or rotated bounding boxes.

Developers can install it with pip, run it from the command line through an example script, deploy a FastAPI template with routes for detection, recognition, OCR and KIE, or use the provided Docker images with GPU support.

Key features

  • 01Two-stage OCR pipeline combining text detection and text recognition.
  • 02Accepts PDFs, images and web pages as input.
  • 03Multiple pretrained detection and recognition architectures to choose from.
  • 04Key information extraction predictor for multi-class detection.
  • 05Exports results as structured objects or nested JSON, with visualization and page synthesis.
  • 06Supports PyTorch and TensorFlow 2 backends, with Docker images that include GPU support.

Use cases

  • Extracting words and their positions from scanned documents or PDFs.
  • Pulling specific fields such as dates or addresses from forms using the KIE predictor.
  • Serving OCR as an API endpoint with the included FastAPI template.
  • Recognizing table structures or page layout as part of a document-processing pipeline.

Topics

FAQ

What is doctr?
An open-source Python OCR library that detects and recognizes text in PDFs and images using deep learning models built on PyTorch. docTR (Document Text Recognition) is a Python library for optical character recognition. It runs end-to-end OCR in two stages: a text detection model first localizes words on a page, then a text recognition model reads the characters in each word. Inputs can be PDFs, image files, or web pages rendered to documents, and the output is a structured Document object with pages, blocks, lines and words that can be exported as nested JSON.
Is doctr free to use? What license does it have?
doctr is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is doctr still maintained?
Actively maintained. The last commit to doctr was on Oct 16, 2026.
What can I use doctr for?
Extracting words and their positions from scanned documents or PDFs. Pulling specific fields such as dates or addresses from forms using the KIE predictor. Serving OCR as an API endpoint with the included FastAPI template. Recognizing table structures or page layout as part of a document-processing pipeline.
Where can I get doctr?
The source code and installation instructions are on GitHub: https://github.com/mindee/doctr

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects