ONNX 模型库
返回模型

说明文档

PP-OCR ONNX 模型

来自 PaddleOCR 的多语言 OCR 模型,已转换为 ONNX 格式,适用于生产环境部署。

作为完整流水线使用:与 monkt.com 集成,实现端到端文档处理。

来源PaddlePaddle PP-OCRv5 合集
格式:ONNX(针对推理优化)
许可证:Apache 2.0


概述

16 个模型,覆盖 48+ 种语言

  • 11 个 PP-OCRv5 模型(最新版本,精度最高)
  • 5 个 PP-OCRv3 模型(旧版本,提供额外语言支持)

快速开始

从 HuggingFace 下载

pip install huggingface_hub rapidocr-onnxruntime

<details> <summary><b>下载特定语言模型</b></summary>

from huggingface_hub import hf_hub_download

# Download English models
det_path = hf_hub_download(\"monkt/paddleocr-onnx\", \"detection/v5/det.onnx\")
rec_path = hf_hub_download(\"monkt/paddleocr-onnx\", \"languages/english/rec.onnx\")
dict_path = hf_hub_download(\"monkt/paddleocr-onnx\", \"languages/english/dict.txt\")

# Use with RapidOCR
from rapidocr_onnxruntime import RapidOCR
ocr = RapidOCR(det_model_path=det_path, rec_model_path=rec_path, rec_keys_path=dict_path)
result, elapsed = ocr(\"document.jpg\")

</details>

<details> <summary><b>下载整个语言文件夹</b></summary>

from huggingface_hub import snapshot_download

# Download all French/German/Spanish (Latin) models
snapshot_download(\"monkt/paddleocr-onnx\", allow_patterns=[\"detection/v5/*\", \"languages/latin/*\"])

# Download Arabic models (v3)
snapshot_download(\"monkt/paddleocr-onnx\", allow_patterns=[\"detection/v3/*\", \"languages/arabic/*\"])

</details>

<details> <summary><b>克隆整个仓库</b></summary>

git clone https://huggingface.co/monkt/paddleocr-onnx
cd paddleocr-onnx

</details>

基本用法

from rapidocr_onnxruntime import RapidOCR

ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/english/rec.onnx\",
    rec_keys_path=\"languages/english/dict.txt\"
)

result, elapsed = ocr(\"document.jpg\")
for line in result:
    print(line[1][0])  # Extracted text

可用模型

PP-OCRv5 识别模型

语言组 路径 语言 精度 大小
英语 languages/english/ 英语 85.25% 7.5 MB
拉丁语系 languages/latin/ 法语、德语、西班牙语、意大利语、葡萄牙语等 27 种语言 84.7% 7.5 MB
东斯拉夫语系 languages/eslav/ 俄语、保加利亚语、乌克兰语、白俄罗斯语 81.6% 7.5 MB
韩语 languages/korean/ 韩语 88.0% 13 MB
中文/日语 languages/chinese/ 中文、日语 - 81 MB
泰语 languages/thai/ 泰语 82.68% 7.5 MB
希腊语 languages/greek/ 希腊语 89.28% 7.4 MB

PP-OCRv3 识别模型(旧版本)

语言组 路径 语言 版本 大小
梵文字母 languages/hindi/ 印地语、马拉地语、尼泊尔语、梵语 v3 8.6 MB
阿拉伯语系 languages/arabic/ 阿拉伯语、乌尔都语、波斯语 v3 8.6 MB
泰米尔语 languages/tamil/ 泰米尔语 v3 8.6 MB
泰卢固语 languages/telugu/ 泰卢固语 v3 8.6 MB

检测模型

模型 路径 版本 大小
PP-OCRv5 检测 detection/v5/det.onnx v5 84 MB
PP-OCRv3 检测 detection/v3/det.onnx v3 2.3 MB

注意:v5 检测模型需配合 v5 识别模型使用。v3 检测模型需配合 v3 识别模型使用。

预处理模型(可选)

模型 路径 用途 精度 大小
文档方向分类 preprocessing/doc-orientation/ 校正旋转文档(0°、90°、180°、270°) 99.06% 6.5 MB
文本行方向分类 preprocessing/textline-orientation/ 校正倒置文本(0°、180°) 98.85% 6.5 MB
文档去弯曲 preprocessing/doc-unwarping/ 修复弯曲/翘曲文档 - 30 MB

语言支持

PP-OCRv5 语言(40+ 种)

拉丁字母(32 种语言):英语、法语、德语、西班牙语、意大利语、葡萄牙语、荷兰语、波兰语、捷克语、斯洛伐克语、克罗地亚语、波斯尼亚语、塞尔维亚语、斯洛文尼亚语、丹麦语、挪威语、瑞典语、冰岛语、爱沙尼亚语、立陶宛语、匈牙利语、阿尔巴尼亚语、威尔士语、爱尔兰语、土耳其语、印度尼西亚语、马来语、南非荷兰语、斯瓦希里语、他加禄语、乌兹别克语、拉丁语

西里尔字母:俄语、保加利亚语、乌克兰语、白俄罗斯语

东亚语言:中文(简体、繁体)、日语(平假名、片假名、汉字)、韩语

东南亚语言:泰语

其他:希腊语

PP-OCRv3 语言(8 种)

南亚语言:印地语、马拉地语、尼泊尔语、梵语、泰米尔语、泰卢固语

中东语言:阿拉伯语、乌尔都语、波斯语


使用示例

<details> <summary><b>PP-OCRv5 模型(英语、拉丁语系、东亚语言等)</b></summary>

from rapidocr_onnxruntime import RapidOCR

# English
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/english/rec.onnx\",
    rec_keys_path=\"languages/english/dict.txt\"
)

# French, German, Spanish, etc. (32 languages)
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/latin/rec.onnx\",
    rec_keys_path=\"languages/latin/dict.txt\"
)

# Russian, Bulgarian, Ukrainian, Belarusian
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/eslav/rec.onnx\",
    rec_keys_path=\"languages/eslav/dict.txt\"
)

# Korean
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/korean/rec.onnx\",
    rec_keys_path=\"languages/korean/dict.txt\"
)

# Chinese/Japanese
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/chinese/rec.onnx\",
    rec_keys_path=\"languages/chinese/dict.txt\"
)

# Thai
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/thai/rec.onnx\",
    rec_keys_path=\"languages/thai/dict.txt\"
)

# Greek
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/greek/rec.onnx\",
    rec_keys_path=\"languages/greek/dict.txt\"
)

</details>

<details> <summary><b>PP-OCRv3 模型(印地语、阿拉伯语、泰米尔语、泰卢固语)</b></summary>

from rapidocr_onnxruntime import RapidOCR

# Hindi, Marathi, Nepali, Sanskrit
ocr = RapidOCR(
    det_model_path=\"detection/v3/det.onnx\",
    rec_model_path=\"languages/hindi/rec.onnx\",
    rec_keys_path=\"languages/hindi/dict.txt\"
)

# Arabic, Urdu, Persian/Farsi
ocr = RapidOCR(
    det_model_path=\"detection/v3/det.onnx\",
    rec_model_path=\"languages/arabic/rec.onnx\",
    rec_keys_path=\"languages/arabic/dict.txt\"
)

# Tamil
ocr = RapidOCR(
    det_model_path=\"detection/v3/det.onnx\",
    rec_model_path=\"languages/tamil/rec.onnx\",
    rec_keys_path=\"languages/tamil/dict.txt\"
)

# Telugu
ocr = RapidOCR(
    det_model_path=\"detection/v3/det.onnx\",
    rec_model_path=\"languages/telugu/rec.onnx\",
    rec_keys_path=\"languages/telugu/dict.txt\"
)

</details>


带预处理的完整流水线

<details> <summary><b>针对旋转/扭曲文档的可选预处理</b></summary>

预处理模型可提高旋转或扭曲文档的识别精度:

from rapidocr_onnxruntime import RapidOCR

# Complete pipeline with preprocessing
ocr = RapidOCR(
    det_model_path=\"detection/v5/det.onnx\",
    rec_model_path=\"languages/english/rec.onnx\",
    rec_keys_path=\"languages/english/dict.txt\",
    # Optional preprocessing
    use_angle_cls=True,
    angle_cls_model_path=\"preprocessing/textline-orientation/PP-LCNet_x1_0_textline_ori.onnx\"
)

result, elapsed = ocr(\"rotated_document.jpg\")

何时使用预处理

  • 文档方向分类doc-orientation/):旋转角度未知的扫描文档(0°/90°/180°/270°)
  • 文本行方向分类textline-orientation/):倒置的文本行(0°/180°)
  • 文档去弯曲doc-unwarping/):弯曲页面、翘曲文档、相机拍摄的照片

性能影响:在扭曲图像上精度提升 10-30%,速度开销极小。

</details>


仓库结构

.
├── detection/
│   ├── v5/
│   │   ├── det.onnx             # 84 MB - PP-OCRv5 detection
│   │   └── config.json
│   └── v3/
│       ├── det.onnx             # 2.3 MB - PP-OCRv3 detection
│       └── config.json
│
├── languages/
│   ├── english/
│   │   ├── rec.onnx             # 7.5 MB
│   │   ├── dict.txt
│   │   └── config.json
│   ├── latin/                   # 32 languages
│   ├── eslav/                   # Russian, Bulgarian, Ukrainian, Belarusian
│   ├── korean/
│   ├── chinese/                 # Chinese, Japanese
│   ├── thai/
│   ├── greek/
│   ├── hindi/                   # Hindi, Marathi, Nepali, Sanskrit (v3)
│   ├── arabic/                  # Arabic, Urdu, Persian (v3)
│   ├── tamil/                   # Tamil (v3)
│   └── telugu/                  # Telugu (v3)
│
└── preprocessing/
    ├── doc-orientation/
    ├── textline-orientation/
    └── doc-unwarping/

模型选择

文档语言 模型路径
英语 languages/english/
法语、德语、西班牙语、意大利语、葡萄牙语 languages/latin/
俄语、保加利亚语、乌克兰语、白俄罗斯语 languages/eslav/
韩语 languages/korean/
中文、日语 languages/chinese/
泰语 languages/thai/
希腊语 languages/greek/
印地语、马拉地语、尼泊尔语、梵语 languages/hindi/ + detection/v3/
阿拉伯语、乌尔都语、波斯语 languages/arabic/ + detection/v3/
泰米尔语 languages/tamil/ + detection/v3/
泰卢固语 languages/telugu/ + detection/v3/

技术规格

  • 框架:PaddleOCR → ONNX
  • ONNX Opset:11
  • 精度:FP32
  • 输入格式:RGB 图像(动态尺寸)
  • 推理:通过 onnxruntime 在 CPU/GPU 上运行

检测模型

  • 输入(batch, 3, height, width) - 动态
  • 输出:文本边界框

识别模型

  • 输入(batch, 3, 32, width) - 高度固定为 32px
  • 输出:CTC logits → 使用字典解码

性能

精度(PP-OCRv5)

模型 精度 数据集
希腊语 89.28% 2,799 张图像
韩语 88.0% 5,007 张图像
英语 85.25% 6,530 张图像
拉丁语系 84.7% 3,111 张图像
泰语 82.68% 4,261 张图像
东斯拉夫语系 81.6% 7,031 张图像

常见问题

问:应该使用哪个版本?
答:使用 PP-OCRv5 模型可获得最佳精度。仅当需要 v5 不支持的南亚语言时,才使用 PP-OCRv3。

问:可以混用 v5 和 v3 模型吗?
答:不可以。v5 识别模型需配合 detection/v5/det.onnx 使用,v3 识别模型需配合 detection/v3/det.onnx 使用。

问:支持 GPU 加速吗?
答:支持。安装 onnxruntime-gpu 替代 onnxruntime,推理速度可提升 10 倍。

问:可以商用吗?
答:可以。Apache 2.0 许可证允许商业用途。


致谢


链接


许可证:Apache 2.0

monkt/paddleocr-onnx

作者 monkt

image-to-text onnx
↓ 0 ♥ 45

创建时间: 2025-10-07 03:01:23+00:00

更新时间: 2025-10-07 05:37:22+00:00

在 Hugging Face 上查看

文件 (45)

.gitattributes
README.md
detection/v3/config.json
detection/v3/det.onnx ONNX
detection/v5/config.json
detection/v5/det.onnx ONNX
languages/arabic/config.json
languages/arabic/dict.txt
languages/arabic/rec.onnx ONNX
languages/chinese/config.json
languages/chinese/dict.txt
languages/chinese/rec.onnx ONNX
languages/english/config.json
languages/english/dict.txt
languages/english/rec.onnx ONNX
languages/eslav/config.json
languages/eslav/dict.txt
languages/eslav/rec.onnx ONNX
languages/greek/config.json
languages/greek/dict.txt
languages/greek/rec.onnx ONNX
languages/hindi/config.json
languages/hindi/dict.txt
languages/hindi/rec.onnx ONNX
languages/korean/config.json
languages/korean/dict.txt
languages/korean/rec.onnx ONNX
languages/latin/config.json
languages/latin/dict.txt
languages/latin/rec.onnx ONNX
languages/tamil/config.json
languages/tamil/dict.txt
languages/tamil/rec.onnx ONNX
languages/telugu/config.json
languages/telugu/dict.txt
languages/telugu/rec.onnx ONNX
languages/thai/config.json
languages/thai/dict.txt
languages/thai/rec.onnx ONNX
preprocessing/doc-orientation/PP-LCNet_x1_0_doc_ori.onnx ONNX
preprocessing/doc-orientation/config.json
preprocessing/doc-unwarping/UVDoc.onnx ONNX
preprocessing/doc-unwarping/config.json
preprocessing/textline-orientation/PP-LCNet_x1_0_textline_ori.onnx ONNX
preprocessing/textline-orientation/config.json