File size: 5,143 Bytes
7347aa3 d2ffb23 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
---
license: apache-2.0
library_name: onnx
pipeline_tag: image-to-text
tags:
- ocr
- paddleocr
- onnx
- computer-vision
- text-detection
- text-recognition
- multilingual
datasets:
- community-datasets
language:
- en
- zh
- multilingual
widget:
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
example_title: Sample OCR
---
# PaddleOCR ONNX Models
π₯ **ONNX format models converted from PaddleOCR for easy deployment and testing**
## π Model Description
This repository contains ONNX format models converted from [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR), a practical ultra-lightweight OCR system. These models are optimized for production deployment and cross-platform compatibility.
## π¦ Model Files
| File Name | Size | Description |
|-----------|------|-------------|
| `PP-OCRv5_server_det_infer.onnx` | 84MB | Text detection model - locates text regions in images |
| `PP-OCRv5_server_rec_infer.onnx` | 81MB | Text recognition model - recognizes text content |
| `UVDoc_infer.onnx` | 30MB | Document rectification model - corrects document perspective |
| `PP-LCNet_x1_0_doc_ori_infer.onnx` | 6.5MB | Document orientation detection |
| `PP-LCNet_x1_0_textline_ori_infer.onnx` | 6.5MB | Text line orientation detection |
| `PP-OCRv5_server_rec_infer.yml` | 145KB | Recognition model configuration file |
**Total Size:** ~208MB
## π Quick Start
### Installation
```bash
pip install huggingface_hub onnxruntime
```
### Download Models
```python
from huggingface_hub import hf_hub_download
import os
def download_paddleocr_models():
"""Download all PaddleOCR ONNX models"""
model_files = [
"PP-OCRv5_server_det_infer.onnx",
"PP-OCRv5_server_rec_infer.onnx",
"UVDoc_infer.onnx",
"PP-LCNet_x1_0_doc_ori_infer.onnx",
"PP-LCNet_x1_0_textline_ori_infer.onnx",
"PP-OCRv5_server_rec_infer.yml"
]
cache_dir = "models"
os.makedirs(cache_dir, exist_ok=True)
for file in model_files:
print(f"Downloading {file}...")
hf_hub_download(
repo_id="marsena/paddleocr-test",
filename=file,
local_dir=cache_dir
)
print("All models downloaded!")
# Download models
download_paddleocr_models()
```
### Basic Usage
```python
import onnxruntime as ort
import numpy as np
from PIL import Image
# Load detection model
det_session = ort.InferenceSession("models/PP-OCRv5_server_det_infer.onnx")
# Load recognition model
rec_session = ort.InferenceSession("models/PP-OCRv5_server_rec_infer.onnx")
# Your OCR pipeline implementation here...
```
## π·οΈ Model Tags
- **Framework:** ONNX
- **Task:** Computer Vision, OCR
- **Language:** Multi-language support
- **Domain:** Text Detection, Text Recognition
## π§ Technical Details
### Conversion Process
These models were converted from PaddlePaddle format to ONNX format for broader compatibility:
1. **Source:** Original PaddleOCR models from PaddlePaddle Hub
2. **Conversion:** PaddlePaddle β ONNX format
3. **Optimization:** Model optimization for inference speed
4. **Validation:** Output consistency verification
### System Requirements
- **Runtime:** ONNX Runtime
- **Python:** 3.7+
- **Memory:** Minimum 2GB RAM recommended
- **Platform:** Cross-platform (Windows, Linux, macOS)
## π License
This project follows the **Apache 2.0 License**, consistent with the original PaddleOCR project.
### Original PaddleOCR License
```
Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
## π Acknowledgments
- **Original Project:** [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) by PaddlePaddle Team
- **Framework:** [PaddlePaddle](https://github.com/PaddlePaddle/Paddle)
- **Conversion Tools:** ONNX ecosystem
## π Citation
If you use these models in your research, please cite the original PaddleOCR paper:
```bibtex
@misc{paddleocr2020,
title={PaddleOCR: Awesome multilingual OCR toolkits},
author={PaddlePaddle Authors},
year={2020},
howpublished={\url{https://github.com/PaddlePaddle/PaddleOCR}}
}
```
## β Issues & Support
For issues related to:
- **Model conversion:** Create an issue in this repository
- **Original PaddleOCR:** Visit [PaddleOCR Issues](https://github.com/PaddlePaddle/PaddleOCR/issues)
- **ONNX Runtime:** Visit [ONNX Runtime Issues](https://github.com/microsoft/onnxruntime/issues)
---
**Note:** This is a community contribution for easier deployment of PaddleOCR models. For production use, please ensure compliance with your specific requirements and test thoroughly. |