PP-OCR ONNX Models
Multilingual OCR models from PaddleOCR, converted to ONNX format for production deployment.
Use as a complete pipeline: Integrate with
monkt.com for end-to-end document processing.
Source:
PaddlePaddle PP-OCRv5 Collection
Format: ONNX (optimized for inference)
License: Apache 2.0
Overview
16 models covering 48+ languages:
- 11 PP-OCRv5 models (latest, highest accuracy)
- 5 PP-OCRv3 models (legacy, additional language support)
Quick Start
Download from HuggingFace
pip install huggingface_hub rapidocr-onnxruntime
Download specific language models
1from huggingface_hub import hf_hub_download
2
3# Download English models
4det_path = hf_hub_download("monkt/paddleocr-onnx", "detection/v5/det.onnx")
5rec_path = hf_hub_download("monkt/paddleocr-onnx", "languages/english/rec.onnx")
6dict_path = hf_hub_download("monkt/paddleocr-onnx", "languages/english/dict.txt")
7
8# Use with RapidOCR
9from rapidocr_onnxruntime import RapidOCR
10ocr = RapidOCR(det_model_path=det_path, rec_model_path=rec_path, rec_keys_path=dict_path)
11result, elapsed = ocr("document.jpg")
Download entire language folder
1from huggingface_hub import snapshot_download
2
3# Download all French/German/Spanish (Latin) models
4snapshot_download("monkt/paddleocr-onnx", allow_patterns=["detection/v5/*", "languages/latin/*"])
5
6# Download Arabic models (v3)
7snapshot_download("monkt/paddleocr-onnx", allow_patterns=["detection/v3/*", "languages/arabic/*"])
Clone entire repository
1git clone https://huggingface.co/monkt/paddleocr-onnx
2cd paddleocr-onnx
Basic Usage
1from rapidocr_onnxruntime import RapidOCR
2
3ocr = RapidOCR(
4 det_model_path="detection/v5/det.onnx",
5 rec_model_path="languages/english/rec.onnx",
6 rec_keys_path="languages/english/dict.txt"
7)
8
9result, elapsed = ocr("document.jpg")
10for line in result:
11 print(line[1][0]) # Extracted text
Available Models
PP-OCRv5 Recognition Models
| Language Group | Path | Languages | Accuracy | Size |
|---|
| English | languages/english/ | English | 85.25% | 7.5 MB |
| Latin | languages/latin/ | French, German, Spanish, Italian, Portuguese, + 27 more | 84.7% | 7.5 MB |
| East Slavic | languages/eslav/ | Russian, Bulgarian, Ukrainian, Belarusian | 81.6% | 7.5 MB |
| Korean | languages/korean/ | Korean | 88.0% | 13 MB |
| Chinese/Japanese | languages/chinese/ | Chinese, Japanese | - | 81 MB |
| Thai | languages/thai/ | Thai | 82.68% | 7.5 MB |
| Greek | languages/greek/ | Greek | 89.28% | 7.4 MB |
PP-OCRv3 Recognition Models (Legacy)
| Language Group | Path | Languages | Version | Size |
|---|
| Devanagari | languages/hindi/ | Hindi, Marathi, Nepali, Sanskrit | v3 | 8.6 MB |
| Arabic | languages/arabic/ | Arabic, Urdu, Persian/Farsi | v3 | 8.6 MB |
| Tamil | languages/tamil/ | Tamil | v3 | 8.6 MB |
| Telugu | languages/telugu/ | Telugu | v3 | 8.6 MB |
Detection Models
| Model | Path | Version | Size |
|---|
| PP-OCRv5 Detection | detection/v5/det.onnx | v5 | 84 MB |
| PP-OCRv3 Detection | detection/v3/det.onnx | v3 | 2.3 MB |
Note: Use v5 detection with v5 recognition models. Use v3 detection with v3 recognition models.
Preprocessing Models (Optional)
| Model | Path | Purpose | Accuracy | Size |
|---|
| Document Orientation | preprocessing/doc-orientation/ | Corrects rotated documents (0°, 90°, 180°, 270°) | 99.06% | 6.5 MB |
| Text Line Orientation | preprocessing/textline-orientation/ | Corrects upside-down text (0°, 180°) | 98.85% | 6.5 MB |
| Document Unwarping | preprocessing/doc-unwarping/ | Fixes curved/warped documents | - | 30 MB |
Language Support
PP-OCRv5 Languages (40+)
Latin Script (32 languages): English, French, German, Spanish, Italian, Portuguese, Dutch, Polish, Czech, Slovak, Croatian, Bosnian, Serbian, Slovenian, Danish, Norwegian, Swedish, Icelandic, Estonian, Lithuanian, Hungarian, Albanian, Welsh, Irish, Turkish, Indonesian, Malay, Afrikaans, Swahili, Tagalog, Uzbek, Latin
Cyrillic: Russian, Bulgarian, Ukrainian, Belarusian
East Asian: Chinese (Simplified, Traditional), Japanese (Hiragana, Katakana, Kanji), Korean
Southeast Asian: Thai
Other: Greek
PP-OCRv3 Languages (8)
South Asian: Hindi, Marathi, Nepali, Sanskrit, Tamil, Telugu
Middle Eastern: Arabic, Urdu, Persian/Farsi
Usage Examples
PP-OCRv5 Models (English, Latin, East Asian, etc.)
1from rapidocr_onnxruntime import RapidOCR
2
3# English
4ocr = RapidOCR(
5 det_model_path="detection/v5/det.onnx",
6 rec_model_path="languages/english/rec.onnx",
7 rec_keys_path="languages/english/dict.txt"
8)
9
10# French, German, Spanish, etc. (32 languages)
11ocr = RapidOCR(
12 det_model_path="detection/v5/det.onnx",
13 rec_model_path="languages/latin/rec.onnx",
14 rec_keys_path="languages/latin/dict.txt"
15)
16
17# Russian, Bulgarian, Ukrainian, Belarusian
18ocr = RapidOCR(
19 det_model_path="detection/v5/det.onnx",
20 rec_model_path="languages/eslav/rec.onnx",
21 rec_keys_path="languages/eslav/dict.txt"
22)
23
24# Korean
25ocr = RapidOCR(
26 det_model_path="detection/v5/det.onnx",
27 rec_model_path="languages/korean/rec.onnx",
28 rec_keys_path="languages/korean/dict.txt"
29)
30
31# Chinese/Japanese
32ocr = RapidOCR(
33 det_model_path="detection/v5/det.onnx",
34 rec_model_path="languages/chinese/rec.onnx",
35 rec_keys_path="languages/chinese/dict.txt"
36)
37
38# Thai
39ocr = RapidOCR(
40 det_model_path="detection/v5/det.onnx",
41 rec_model_path="languages/thai/rec.onnx",
42 rec_keys_path="languages/thai/dict.txt"
43)
44
45# Greek
46ocr = RapidOCR(
47 det_model_path="detection/v5/det.onnx",
48 rec_model_path="languages/greek/rec.onnx",
49 rec_keys_path="languages/greek/dict.txt"
50)
PP-OCRv3 Models (Hindi, Arabic, Tamil, Telugu)
1from rapidocr_onnxruntime import RapidOCR
2
3# Hindi, Marathi, Nepali, Sanskrit
4ocr = RapidOCR(
5 det_model_path="detection/v3/det.onnx",
6 rec_model_path="languages/hindi/rec.onnx",
7 rec_keys_path="languages/hindi/dict.txt"
8)
9
10# Arabic, Urdu, Persian/Farsi
11ocr = RapidOCR(
12 det_model_path="detection/v3/det.onnx",
13 rec_model_path="languages/arabic/rec.onnx",
14 rec_keys_path="languages/arabic/dict.txt"
15)
16
17# Tamil
18ocr = RapidOCR(
19 det_model_path="detection/v3/det.onnx",
20 rec_model_path="languages/tamil/rec.onnx",
21 rec_keys_path="languages/tamil/dict.txt"
22)
23
24# Telugu
25ocr = RapidOCR(
26 det_model_path="detection/v3/det.onnx",
27 rec_model_path="languages/telugu/rec.onnx",
28 rec_keys_path="languages/telugu/dict.txt"
29)
Full Pipeline with Preprocessing
Optional preprocessing for rotated/distorted documents
Preprocessing models improve accuracy on rotated or distorted documents:
1from rapidocr_onnxruntime import RapidOCR
2
3# Complete pipeline with preprocessing
4ocr = RapidOCR(
5 det_model_path="detection/v5/det.onnx",
6 rec_model_path="languages/english/rec.onnx",
7 rec_keys_path="languages/english/dict.txt",
8 # Optional preprocessing
9 use_angle_cls=True,
10 angle_cls_model_path="preprocessing/textline-orientation/PP-LCNet_x1_0_textline_ori.onnx"
11)
12
13result, elapsed = ocr("rotated_document.jpg")
When to use preprocessing:
- Document Orientation (
doc-orientation/): Scanned documents with unknown rotation (0°/90°/180°/270°)
- Text Line Orientation (
textline-orientation/): Upside-down text lines (0°/180°)
- Document Unwarping (
doc-unwarping/): Curved pages, warped documents, camera photos
Performance impact: +10-30% accuracy on distorted images, minimal speed overhead.
Repository Structure
.
├── 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/
Model Selection
| Document Language | Model Path |
|---|
| English | languages/english/ |
| French, German, Spanish, Italian, Portuguese | languages/latin/ |
| Russian, Bulgarian, Ukrainian, Belarusian | languages/eslav/ |
| Korean | languages/korean/ |
| Chinese, Japanese | languages/chinese/ |
| Thai | languages/thai/ |
| Greek | languages/greek/ |
| Hindi, Marathi, Nepali, Sanskrit | languages/hindi/ + detection/v3/ |
| Arabic, Urdu, Persian/Farsi | languages/arabic/ + detection/v3/ |
| Tamil | languages/tamil/ + detection/v3/ |
| Telugu | languages/telugu/ + detection/v3/ |
Technical Specifications
- Framework: PaddleOCR → ONNX
- ONNX Opset: 11
- Precision: FP32
- Input Format: RGB images (dynamic size)
- Inference: CPU/GPU via onnxruntime
Detection Model
- Input:
(batch, 3, height, width) - dynamic
- Output: Text bounding boxes
Recognition Model
- Input:
(batch, 3, 32, width) - height fixed at 32px
- Output: CTC logits → decoded with dictionary
Performance
Accuracy (PP-OCRv5)
| Model | Accuracy | Dataset |
|---|
| Greek | 89.28% | 2,799 images |
| Korean | 88.0% | 5,007 images |
| English | 85.25% | 6,530 images |
| Latin | 84.7% | 3,111 images |
| Thai | 82.68% | 4,261 images |
| East Slavic | 81.6% | 7,031 images |
FAQ
Q: Which version should I use?
A: Use PP-OCRv5 models for best accuracy. Use PP-OCRv3 only for South Asian languages not available in v5.
Q: Can I mix v5 and v3 models?
A: No. Use detection/v5/det.onnx with v5 recognition models, and detection/v3/det.onnx with v3 recognition models.
Q: GPU acceleration?
A: Install onnxruntime-gpu instead of onnxruntime for 10x faster inference.
Q: Commercial use?
A: Yes. Apache 2.0 license allows commercial use.
Credits
Links
License: Apache 2.0