--- id: onnxtr version: "0.8.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 --- # onnxtr — Onnx Text Recognition (OnnxTR): docTR Onnx-Wrapper for high-performance OCR on documents. License: permissive · Maintenance: active · Downloads: 102.3K/mo ## What it is and what it does OnnxTR is an ONNX-based wrapper around the docTR library that performs optical character recognition on documents. It detects and recognizes text by localizing individual words within PDFs, images, and webpages, then returns structured output with nested document hierarchy (pages, blocks, lines, words). Unlike the base docTR library, OnnxTR avoids PyTorch and TensorFlow dependencies, instead using ONNX Runtime for inference, which reduces package size and enables deployment on resource-constrained environments. The package supports multiple execution backends: CPU, CUDA (NVIDIA GPUs), OpenVINO (Intel CPUs and GPUs), and CoreML (Apple Silicon). It offers 8-bit quantized models for faster CPU inference and lower memory footprint. Output can be exported as nested dictionaries (JSON-compatible), human-readable text, or hOCR XML format. Configuration is granular—you can tune detection and recognition batch sizes, enable orientation and language detection, control page straightening, and adjust document parsing behavior. Use it for: - Extract text from scanned PDF documents for downstream NLP or search indexing - Batch process images on CPU-only servers without GPU infrastructure - Deploy OCR on edge devices or embedded systems with limited memory and compute - Detect and recognize text in multi-page documents with automatic line and block grouping - Export document structure as XML (hOCR) for archival or accessibility compliance ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. OnnxTR extracts and recognizes text from documents (PDFs, images, webpages) using ONNX-based deep learning models, localizing and identifying words without requiring PyTorch or TensorFlow. Yes, if you need OCR without PyTorch/TensorFlow overhead and can target Python 3.10+. The low install friction, active maintenance, permissive license, and support for multiple hardware backends (CPU, GPU, Intel, Apple Silicon) make it a practical choice for document text extraction. No known security vulnerabilities. Consider it especially for resource-constrained deployments or when ONNX Runtime is already in your stack. ## Install pip install onnxtr uv add onnxtr poetry add onnxtr ## Installing onnxtr Before you install: Low install friction; pure Python wheel with 11 runtime dependencies. Actively maintained with recent commits. Requires Python 3.10 or higher. Optional extras for GPU (CUDA), Intel (OpenVINO), and visualization support are available. License in practice: Apache License 2.0 (permissive): you can use, modify, and distribute OnnxTR freely in commercial and private projects, provided you include the license and attribute the original work. Quickstart: pip install "onnxtr[cpu]" from onnxtr.io import DocumentFile from onnxtr.models import ocr_predictor model = ocr_predictor(det_arch='fast_base', reco_arch='vitstr_base') doc = DocumentFile.from_pdf("path/to/doc.pdf") result = model(doc) json_output = result.export() Requires Python 3.10 or higher. GPU support requires CUDA and cuDNN to be pre-installed separately. Verify before relying: - Accuracy comparison with PyTorch/TensorFlow-based OCR pipelines on standard benchmarks - Performance metrics (inference latency, memory usage) for 8-bit quantized models on typical hardware - Whether weasyprint is required for webpage parsing or optional ## 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: 102.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags OCR document text extraction, onnx text recognition, pdf text detection and recognition, lightweight document analysis, cpu-friendly ocr models, doctr onnx wrapper, document ai processing, ocr, document-processing, onnx-inference [View on SkillFed](https://skillfed.io/packages/onnxtr) · [View on PyPI](https://pypi.org/project/onnxtr/)