Favicon of docTR

docTR

An open-source Python OCR library that extracts text from PDFs and images locally with PyTorch, CPU or GPU support, and document layout detection.

Screenshot of docTR website

docTR reads text from PDFs and images for developers building document processing applications and researchers comparing OCR models. It locates individual words and recognizes their text on your own hardware.

  • Pretrained OCR models: Choose detection and recognition models separately, pairing detectors such as DBNet or FAST with recognizers such as CRNN, PARSeq or ViTSTR.
  • Layout and orientation: Detect tables, figures and headers, process rotated pages and words, and inspect predictions visually.
  • Field extraction: Combine text recognition with a detector trained for specific classes, such as dates or addresses, to group results by field type.
  • Training and comparison: Train your own models and compare speed and recognition performance on public datasets, including FUNSD, CORD and SROIE.

The library uses PyTorch and is open source under Apache 2.0. Inference runs locally on CPU or GPU, and Docker deployment supports NVIDIA GPU acceleration. A FastAPI template provides a starting point for a self-hosted document API. The Streamlit demo runs locally in a browser; the separate Hugging Face Spaces demo runs on hosted infrastructure.

Similar to docTR