RapidOCR

A fast, offline Python OCR library with pluggable ONNX Runtime, OpenVINO, and PaddlePaddle inference backends.

Library
PyPI
v1.4.4
7,619stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity96
Maintenance96
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture85
Code Quality80
Innovation82
Learning Curve90

RapidOCR converts the models behind PaddleOCR into the ONNX format so text detection, angle classification, and text recognition can run fast and fully offline across Python, C++, Java, C#, and mobile targets. The Python package wraps a three-stage pipeline (detect → classify → recognize) behind a single RapidOCR class, with each stage lazily loaded behind a thread lock so unused stages never pay their model-load cost.

Because inference is decoupled from any one runtime, the same pipeline can execute against ONNX Runtime, OpenVINO, PaddlePaddle, PyTorch, or TensorRT depending on what’s installed and what the deployment target needs — CPU-only edge devices, GPU servers, or embedded environments. Default models cover Chinese and English out of the box, with a documented model list for other languages, and results can be exported as text, JSON, or Markdown or rendered visually over the source image.

What You Get

  • A RapidOCR class that runs the full detect → classify → recognize pipeline from a single call on an image path, URL, bytes, or numpy array
  • A pluggable inference-engine layer supporting ONNX Runtime, OpenVINO, PaddlePaddle, PyTorch, and TensorRT, selected via config without changing calling code
  • Default Chinese/English models bundled, with additional language models resolvable and downloaded on demand via model_resolver
  • Built-in result export to plain text, JSON, or Markdown, plus a .vis() helper to render detected boxes and recognized text back onto the image
  • A rapidocr CLI entry point for running OCR from the command line without writing Python

Common Use Cases

  • Extracting text from scanned documents or photos in offline or air-gapped environments where cloud OCR APIs aren’t usable
  • Feeding OCR output into downstream document-understanding or RAG pipelines (used by projects like Docling and Langchain-Chatchat)
  • Building lightweight desktop or CLI OCR tools that need to run on CPU without a large deep-learning framework installed
  • Automating text extraction from UI screenshots or game clients (used by automation projects like arknights-mower)

Under The Hood

Architecture RapidOCR structures its pipeline as three independently loadable stages — text detection (ch_ppocr_det), angle classification (ch_ppocr_cls), and text recognition (ch_ppocr_rec) — orchestrated by the RapidOCR class in main.py, which loads each model lazily behind its own threading.Lock so a call that only needs detection never initializes the recognizer. Configuration flows through an omegaconf DictConfig parsed from config.yaml and mergeable with runtime params, and the inference-engine selection is resolved through a factory (inference_engine/base.py: get_engine()) that dynamically imports the backend module (ONNX Runtime, OpenVINO, PaddlePaddle, PyTorch, or TensorRT) named in config, keeping the pipeline logic decoupled from any single runtime.

Tech Stack The package targets Python 3.8–4, built with setuptools and setuptools-scm for git-tag-derived dynamic versioning, and declares its runtime dependencies (pyclipper, opencv-python, numpy<3.0.0, Shapely, PyYAML, Pillow, tqdm, omegaconf, requests, colorlog) in a plain requirements.txt consumed dynamically by pyproject.toml. Inference-engine packages themselves (onnxruntime, openvino, paddlepaddle, torch, tensorrt) are treated as optional extras and imported only when their engine type is selected, keeping the base install lean; a rapidocr console script is registered via project.scripts for CLI use.

Code Quality The tests/ directory is extensive — dedicated pytest modules cover the CLI, classifier, default config, the full det+cls+rec pipeline, per-engine config, image preprocessing, input-type handling, lazy model loading, model resolution, per-language recognition, word-box output, and output-format conversion — parametrized across engine types. A .pre-commit-config.yaml enforces formatting (black) before commits, and pipeline stages raise a custom RapidOCRError that call sites catch explicitly and log rather than letting failures pass silently.

What Makes It Unique RapidOCR’s differentiator is converting PaddleOCR’s models into ONNX once and then fanning that single model format out across five different inference backends and five different language runtimes (Python, C++, Java, C#, plus mobile/embedded targets in the monorepo), so the same lightweight, CPU-friendly models can be deployed nearly anywhere without depending on PaddlePaddle itself at inference time — a meaningfully different distribution strategy than most single-backend OCR libraries.

Used by 5 apps in this directory

Python
81%
Apache 2.0

headroom

AI Development · Developer Tools

68,054

Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.

View details
84
Repo Health
86
Technical
72
Dependency
Built with
Python81%
Rust13%
Updated today
Python
51%
AGPL 3.0

Khoj

AI Assistants · Knowledge Management · Productivity

36,791

A self-hostable AI second brain that chats with your documents, searches the web, builds custom agents, and runs entirely on your own LLM.

View details
76
Repo Health
82
Technical
70
Dependency
Built with
Python51%
TypeScript36%
Updated 4 weeks ago
Python
68%
MIT

Langflow

AI Agents · AI Development

153,880

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today
Python
37%
Other

Open WebUI

AI Assistants · AI Agents

150,393

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
67
Dependency
Built with
Python37%
Svelte34%
JavaScript21%
Updated yesterday
Python
67%
Apache 2.0

otari

AI Development · Developer Tools

417

A self-hosted, OpenAI-compatible LLM gateway that puts one endpoint in front of 40+ providers, with virtual API keys, per-user budgets enforced before spend, and full usage tracking.

View details
79
Repo Health
88
Technical
77
Dependency
Built with
Python67%
TypeScript32%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search