Registry / ai-ml / onnxocr-ppocrv5

onnxocr-ppocrv5

JSON →
library0.0.18pypypi✓ verified 86d ago

`onnxocr-ppocrv5` is a Python library providing an ONNX-based inference pipeline for Baidu's PP-OCRv5. It aims for efficient optical character recognition by leveraging ONNX Runtime for high-performance inference. The current version is 0.0.14, and releases appear to be infrequent, typically focusing on specific model updates or bug fixes.

pip install onnxocr-ppocrv5
INSTALL
IMPORT
SIG · ONNXOCR-PPOCRV5
O
onnxocr-ppocrv5
ai-mlpythonv0.0.18
Install
5.4s avg
Import
—
Disk
143MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.0.18 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
build_error
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 5.4s · import 0.000s · 142MB
143MB installed
● package 143MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OnnxOCR
✓ import onnxocr
✗ from onnxocr import OnnxOCR

This quickstart demonstrates how to initialize the `OnnxOCR` model and perform OCR on a local image file. The model automatically downloads necessary ONNX files on the first run, which requires an internet connection and sufficient disk space.

import os from onnxocr_ppocrv5 import OnnxOCR # NOTE: Replace with a path to your actual image file # For demonstration, we assume an image 'example.png' exists in the current directory # In a real application, you might download or provide an actual image path. image_path = os.environ.get('OCR_IMAGE_PATH', 'example.png') # The first initialization will automatically download necessary models (~300-500 MB) # This requires an internet connection and can take some time. print("Initializing OnnxOCR model... (models will download on first run)") ocr = OnnxOCR() print("OCR model initialized.") # Perform OCR on an image file path # Ensure the image_path points to a valid image accessible by the script. if os.path.exists(image_path): try: result = ocr(image_path) print("OCR Result:") for box_info in result: # Each box_info is a dictionary with 'box' and 'text' print(f" Text: {box_info['text']}, Box: {box_info['box']}") except Exception as e: print(f"Error performing OCR: {e}") print("Please ensure the image_path is valid and the image is not corrupt.") else: print(f"Error: Image file not found at '{image_path}'. Please provide a valid image path.")
Debug
Known issues
gotchaModel files are automatically downloaded during the first initialization of the `OnnxOCR` object. This process requires an active internet connection and can download significant data (hundreds of MBs), potentially causing delays on the first run.
fix
Ensure an active internet connection and sufficient disk space for model storage (~500 MB). The models are cached locally for subsequent runs.
affects: All versions
gotchaBy default, `onnxocr-ppocrv5` installs `onnxruntime` (the CPU version). For GPU acceleration, you must manually uninstall `onnxruntime` and install `onnxruntime-gpu`.
fix
To enable GPU inference: `pip uninstall onnxruntime` then `pip install onnxruntime-gpu` (ensure you have compatible CUDA drivers and toolkit installed).
affects: All versions
gotchaThe library is in early development (0.0.x versions). While core functionality is generally stable, the API might undergo minor changes or refinements in future patch releases without explicit breaking change notifications.
fix
Pin the exact version in your `requirements.txt` (`onnxocr-ppocrv5==0.0.14`) for production environments. Regularly check the GitHub repository for updates and release notes.
affects: <1.0.0
gotchaIncorrect image paths or unsupported image formats (e.g., corrupted files, uncommon extensions) passed to the `ocr()` method will result in errors, typically `FileNotFoundError` or internal `OpenCV` errors.
fix
Always verify that the image path exists and points to a valid, supported image file (e.g., JPG, PNG, BMP). Use `os.path.exists()` for paths.
affects: All versions
Upgrade
Version history
0.0.18latest on PyPI · released May 14, 2026
Audit
Dependencies
numpyrequiredFundamental library for numerical operations and array handling.
opencv-pythonrequiredRequired for image processing and manipulation within the OCR pipeline.
onnxruntimerequiredThe core runtime for executing ONNX models. Installs the CPU version by default.
pillowrequiredImage processing library, often used for loading and saving various image formats.
tqdmrequiredUsed to display progress bars, particularly during model downloads.
Agent activity
16 hits · last 30 days
node
16
Resources
onnxocr-ppocrv5 — pip install onnxocr-ppocrv5 · libregistry