ONNX-based OCR (PP-OCRv5) inference pipeline with DirectML support.
Project description
English | 简体中文 |
OnnxOCR
A High-Performance Multilingual OCR Engine Based on ONNX
🚀 Version Updates
- 2025.05.21
- Added PP-OCRv5 model, supporting 5 language types in a single model: Simplified Chinese, Traditional Chinese, Chinese Pinyin, English, and Japanese.
- Overall recognition accuracy improved by 13% compared to PP-OCRv4.
- Accuracy is consistent with PaddleOCR 3.0.
🌟 Core Advantages
- Deep Learning Framework-Free: A universal OCR engine ready for direct deployment.
- Cross-Architecture Support: Uses PaddleOCR-converted ONNX models, rebuilt for deployment on both ARM and x86 architecture computers with unchanged accuracy under limited computing power.
- High-Performance Inference: Faster inference speed on computers with the same performance.
- Multilingual Support: Single model supports 5 language types: Simplified Chinese, Traditional Chinese, Chinese Pinyin, English, and Japanese.
- Model Accuracy: Consistent with PaddleOCR models.
- Domestic Hardware Adaptation: Restructured code architecture for easy adaptation to more domestic GPUs by modifying only the inference engine.
🛠️ Environment Setup
python>=3.6
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
Note:
- The Mobile version model is used by default; the PP-OCRv5_Server-ONNX model offers better performance.
- The Mobile model is already in
onnxocr/models/ppocrv5and requires no download; - The PP-OCRv5_Server-ONNX model is large and uploaded to Baidu Netdisk (extraction code: wu8t). After downloading, place the
detandrecmodels in./models/ppocrv5/to replace the existing ones.
🚀 One-Click Run
python test_ocr.py
📡 API Service (CPU Example)
Start Service
python app-service.py
Test Example
Request
curl -X POST http://localhost:5005/ocr \
-H "Content-Type: application/json" \
-d '{"image": "base64_encoded_image_data"}'
Response
{
"processing_time": 0.456,
"results": [
{
"text": "Name",
"confidence": 0.9999361634254456,
"bounding_box": [[4.0, 8.0], [31.0, 8.0], [31.0, 24.0], [4.0, 24.0]]
},
{
"text": "Header",
"confidence": 0.9998759031295776,
"bounding_box": [[233.0, 7.0], [258.0, 7.0], [258.0, 23.0], [233.0, 23.0]]
}
]
}
🐳 Docker Image Environment (CPU)
Build Image
docker build -t ocr-service .
Run Image
docker run -itd --name onnxocr-service-v3 -p 5006:5005 onnxocr-service:v3
POST Request
url: ip:5006/ocr
Response Example
{
"processing_time": 0.456,
"results": [
{
"text": "Name",
"confidence": 0.9999361634254456,
"bounding_box": [[4.0, 8.0], [31.0, 8.0], [31.0, 24.0], [4.0, 24.0]]
},
{
"text": "Header",
"confidence": 0.9998759031295776,
"bounding_box": [[233.0, 7.0], [258.0, 7.0], [258.0, 23.0], [233.0, 23.0]]
}
]
}
🌟 Effect Demonstration
| Example 1 | Example 2 |
|---|---|
| Example 3 | Example 4 |
|---|---|
| Example 5 | Example 6 |
|---|---|
👨💻 Contact & Communication
Career Opportunities
I am currently seeking job opportunities. Welcome to connect!
OnnxOCR Community
WeChat Group
QQ Group
🎉 Acknowledgments
Thanks to PaddleOCR for technical support!
🌍 Open Source & Donations
I am passionate about open source and AI technology, believing they can bring convenience and help to those in need, making the world a better place. If you recognize this project, you can support it via Alipay or WeChat Pay (please note "Support OnnxOCR" in the remarks).
📈 Star History
🤝 Contribution Guidelines
Welcome to submit Issues and Pull Requests to improve the project together!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onnxocr_ppocrv4-0.0.3.tar.gz.
File metadata
- Download URL: onnxocr_ppocrv4-0.0.3.tar.gz
- Upload date:
- Size: 14.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
090e35c7b38cb323574fff596dd26f6bc10d894f749ea5b559d630b95de5a4fa
|
|
| MD5 |
b20fe31131819be87262c75d6696f950
|
|
| BLAKE2b-256 |
391ad61511727507500f6360734e749e289086b06c09f27ba467e707853f272c
|
File details
Details for the file onnxocr_ppocrv4-0.0.3-py3-none-any.whl.
File metadata
- Download URL: onnxocr_ppocrv4-0.0.3-py3-none-any.whl
- Upload date:
- Size: 14.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5077e57885566a8f1f9199e14f2ec57b1a081c51ee374974ecfc8ab3ee7f8c1
|
|
| MD5 |
6f0b8fce54704c278c1eda0f27cfb9b7
|
|
| BLAKE2b-256 |
c4f3733e5adeacdf6f8459ccf18feb5b68736d83730047d763a232fe5cd43d79
|