OnnxOCR
Multilingual OCR that runs on ONNX Runtime alone
The upstream project is jingsongliujing/OnnxOCR.
This package is built from KumaTea/OnnxOCR.
Install
pip install onnxocr
Requires Python 3.11+. The PP-OCRv5 detection, angle-classification and recognition models are bundled in the wheel (~41 MB).
Optional extras:
| Extra | Enables |
|---|---|
onnxocr[pdf] |
PDF input (pymupdf, pdf2image) |
onnxocr[qwen] |
Qwen3.5-2B ONNX information extraction |
onnxocr[doc] |
RapidDoc document → Markdown pipeline |
onnxocr[office] |
DOCX/PPTX/XLSX/HTML/LaTeX conversion for the doc pipeline |
onnxocr[all] |
everything above |
Usage
import cv2
from onnxocr.onnx_paddleocr import ONNXPaddleOcr
model = ONNXPaddleOcr(use_angle_cls=True, use_gpu=False)
img = cv2.imread("test.jpg")
result = model.ocr(img)
for box, (text, score) in result[0]:
print(f"{score:.3f} {text}")
Save an annotated image:
from onnxocr.onnx_paddleocr import sav2Img
sav2Img(img, result, name="result.jpg")
Non-ASCII paths on Windows need cv2.imdecode rather than cv2.imread:
import numpy as np
img = cv2.imdecode(np.fromfile(path, dtype=np.uint8), cv2.IMREAD_COLOR)
Other modes
ONNXPaddleOcr also exposes license-plate, table and layout recognition via
use_plate_recognition=True, use_table_recognition=True and
use_layout_analysis=True.
Those models are not bundled — download them first:
python scripts/download_models.py --source huggingface
See the upstream README for those modes, the HTTP API service, the WebUI and Docker images.
Metadata
Release files for onnxocr 3.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onnxocr-3.1.1.tar.gz | 43.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onnxocr-3.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.8 MB
Release files / onnxocr-3.1.1.tar.gz
| Download URL | onnxocr-3.1.1.tar.gz |
|---|---|
| Size | 43.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8e92b7ba78a54506920c538798b53342a8205d36842850007e7e5a26ebbeb1a
|
|
BLAKE2b-256 checksum How to use checksums |
008d903547913564e47f02f1559ec9fb4cd4d80a6cb444cbd2c2e8dcf3e79d62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / onnxocr-3.1.1-py3-none-any.whl
| Download URL | onnxocr-3.1.1-py3-none-any.whl |
|---|---|
| Size | 43.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a60ff70a40e412c8c2af1925d619a2514a8fbdd8b5df74ee168f046aed7e2af5
|
|
BLAKE2b-256 checksum How to use checksums |
b3d398980c1d2830e91740e6951b611567224027f58a700589fc0c92b7e70360
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|