vietanhdev's picture
Upload README.md with huggingface_hub
1647f40 verified
|
Raw
History Blame
4.3 kB
---
license: apache-2.0
library_name: tflite
tags:
- ocr
- paddleocr
- text-detection
- text-recognition
- snapdragon
- qualcomm
- on-device
- multilingual
language:
- zh
- ko
pipeline_tag: image-to-text
authors:
- PaddlePaddle / PaddleOCR team (original model)
- Viet-Anh Nguyen (vietanh@nrl.ai) Qualcomm AI Hub compilation & validation
---
# PP-OCRv5 — Snapdragon 8 Elite NPU (int8 TFLite)
PP-OCRv5 text detection and recognition (Chinese + Korean), compiled to **int8 TFLite**
via [Qualcomm AI Hub](https://aihub.qualcomm.com) for the **Snapdragon 8 Elite (SM8750)
Hexagon V79 HTP NPU**.
## Models
| File | Description | Size | NPU latency (S25 Ultra) |
|------|-------------|------|------------------------|
| `pp_ocrv5_det_mobile.tflite` | Text detection (PP-HGNetV2 + DB++) | 807 KB | **1.23 ms** |
| `pp_ocrv5_zh_rec.tflite` | Chinese text recognition (SVTR/CTC) | 22 MB | **0.99 ms** |
| `pp_ocrv5_ko_rec.tflite` | Korean text recognition (SVTR/CTC) | 3.9 MB | **0.49 ms** |
| `pp_ocrv5_lat_rec.tflite` | Latin text recognition (SVTR/CTC) | 2.2 MB | **0.31 ms** |
| `zh_dict.txt` | 18,383-char ZH dictionary (PaddleOCR `ppocrv5_dict.txt`) | — | — |
| `ko_dict.txt` | 11,945-char KO dictionary (PaddleOCR `ppocrv5_korean_dict.txt`) | — | — |
| `lat_dict.txt` | 836-char Latin dictionary (PaddleOCR `ppocrv5_latin_dict.txt`) | — | — |
**Full ZH/KO sign pipeline ≈ 2.2 ms on Hexagon NPU. 100% NPU — zero CPU fallback.**
## Performance
### Latency — Samsung Galaxy S25 Ultra (SM8750, Android 15)
Measured via Qualcomm AI Hub cloud-hosted real device. Bench date: 2026-06-06.
| model | NPU ms | NPU ops | vs ORT CPU |
|-------|--------|---------|------------|
| det | **1.23** | 156/156 (100%) | 105× faster |
| zh rec | **0.99** | 219/219 (100%) | 180× faster |
| ko rec | **0.49** | 223/223 (100%) | 86× faster |
| lat rec | **0.31** | 223/223 (100%) | 148× faster |
AI Hub profile job IDs: det=`jgkd9yowp`, zh=`j56vd1r6p`, ko=`jpv49w9kp`, lat=`jgj1wlwvg`
(viewable with a Qualcomm AI Hub account at `workbench.aihub.qualcomm.com/jobs/<id>` — the
job pages require sign-in, they are not publicly browsable without one).
### Accuracy — public dataset (ReCTS, Apache-2.0)
Real store-front signage photos (200 scored), standard ChineseOCRBench-style substring matching.
| metric | value |
|--------|-------|
| recall@full (answer fully recognized) | **48.5%** |
| mean char-recall | **66.0%** |
ReCTS is VQA-style (ground truth = one region; full-image OCR is substring-matched), so
recall@full understates pure recognition; char-recall reflects character-level quality on
real, cluttered, perspective-distorted signs.
> **Note on this accuracy number:** measured on the float32 ONNX reference implementation
> (det + zh rec via `rapidocr-onnxruntime`), not independently re-measured on the int8 TFLite
> artifacts shipped in this repo. Int8 post-training quantization can shift accuracy from the
> float baseline — treat this as directional for the shipped models, not an exact figure for them.
> **Vietnamese:** PP-OCRv5's Latin dictionary has **no precomposed Vietnamese tone-mark
> vowels** (verified by byte-level grep). **Do not use this for Vietnamese** — use a
> Vietnamese-specialized recognizer (e.g. VietOCR) instead.
## Usage
```python
from huggingface_hub import hf_hub_download
det = hf_hub_download("<REPO_ID>", "pp_ocrv5_det_mobile.tflite")
rec = hf_hub_download("<REPO_ID>", "pp_ocrv5_zh_rec.tflite")
```
Load with LiteRT (TFLite) + the QNN delegate for NPU execution on Snapdragon devices.
## Source models & compilation
- Source: [PaddleOCR 3.x](https://github.com/PaddlePaddle/PaddleOCR) (Apache-2.0)
- ONNX exports: `monkt/paddleocr-onnx` (Apache-2.0, no pickle)
- Compiled: `qai-hub submit_compile_job(..., options="--target_runtime tflite --quantize_full_type int8")`
with random PTQ calibration data (100 samples per model)
## Citation
```bibtex
@software{ppocrv5_snapdragon2026,
author = {{PaddlePaddle / PaddleOCR team}},
title = {{PP-OCRv5}: Multilingual Text Detection and Recognition},
year = {2025},
url = {https://github.com/PaddlePaddle/PaddleOCR}
}
```
AI Hub compilation and NPU validation by Viet-Anh Nguyen (vietanh@nrl.ai), Neural Research Lab.