File size: 3,609 Bytes
0fd18af b8fa34e 0fd18af 7bd912e 0fd18af 7bd912e 0fd18af b8fa34e 0fd18af b8fa34e 7bd912e b29107b 0fd18af 7bd912e | 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 | ---
license: apache-2.0
tags:
- ocr
- paddleocr
- torq
- synaptics
- npu
library_name: torq
---
# PP-OCRv6-tiny for Torq (SL2619 NPU)
PP-OCRv6-tiny optical character recognition compiled for the Synaptics Torq NPU:
DBNet text detection followed by CTC text recognition. Both stages run on the
NPU. Used by the `ppocr` demo in
[torq-examples](https://github.com/synaptics-torq/torq-examples).
The recognition dictionary is Chinese + English (6,904 characters), so Latin
text, digits and punctuation decode natively; Japanese, Korean, Cyrillic and
Arabic are not covered.
| Input — `samples/sample.jpg` | NPU output — boxes + recognized text |
|:---:|:---:|
| <img src="https://huggingface.co/Synaptics/paddle-paddle-tiny/resolve/main/samples/sample.jpg" width="380"> | <img src="https://huggingface.co/Synaptics/paddle-paddle-tiny/resolve/main/assets/sample_ocr.jpg" width="380"> |
All ten lines are read correctly at confidence ≥ 0.966, in 1.7 s end to end on
an SL2619.
## Files
| File | Purpose |
|---|---|
| `ppocr_det_800x608.vmfb` | Detection (DBNet), static 800×608 bf16 input |
| `rec_buckets/rec_w320.vmfb` | Recognition, 48×320 lines |
| `rec_buckets/rec_w640.vmfb` | Recognition, 48×640 lines |
| `rec_buckets/rec_w1280.vmfb` | Recognition, 48×1280 lines |
| `rec_buckets/rec_w2432.vmfb` | Recognition, 48×2432 lines |
| `ppocr_rec.yml` | Recognizer character dictionary |
| `ppocr_det_dynamic.onnx` | fp32 detection, CPU reference for accuracy checks |
| `ppocr_rec_dynamic.onnx` | fp32 recognition, CPU reference for accuracy checks |
| `samples/sample.jpg` | Sample café menu card, 10 text lines |
### Why four recognition models
Recognition input width is static per vmfb. Each detected line is routed to the
narrowest bucket it fits in, so a short label is padded to 320 rather than to
the widest width. Lines longer than 2432 clamp to the widest bucket.
## Usage
```sh
git clone https://github.com/synaptics-torq/torq-examples
cd torq-examples
python setup_demos.py ppocr
cd ppocr
python src/infer.py \
--image ../models/Synaptics/paddle-paddle-tiny/samples/sample.jpg \
--models ../models/Synaptics/paddle-paddle-tiny \
--save-image
```
Either stage can be switched to ONNX Runtime with `--det-backend ort` /
`--rec-backend ort` (plus the matching `--det-onnx` / `--rec-onnx`) to compare
NPU output against a CPU reference.
## Measured on SL2619
`samples/sample.jpg`, 912×1200, 10 text lines detected:
| Stage | Time |
|---|---|
| Detection (800×608) | ~0.53 s |
| Recognition (10 lines, bucketed) | ~1.19 s |
Recognition scales with the number of detected lines, because each line is a
separate invocation — the bucket models are compiled with a static batch of 1.
A dense page of 99 lines takes roughly 22 s.
### About `sample.jpg`
A 912×1200 café menu card, rendered synthetically in DejaVu Serif rather than
photographed, so it carries no third-party image licensing.
Its width/height ratio of 0.76 matches the detector's static 608×800 input.
Preprocessing resizes straight to that shape without preserving aspect, so an
off-ratio image reaches the model stretched — worth matching if you swap in your
own sample.
Recognized output, all ten lines at confidence ≥ 0.966:
```
1 [0.991] BLUE DOOR CAFE 6 [0.995] Smoked Salmon Bagel 9.75
2 [0.996] all day breakfast 7 [1.000] DRINKS
3 [0.999] BREAKFAST 8 [0.975] Espresso 2.75
4 [0.996] Avocado Toast 6.50 9 [0.966] Fresh Orange Juice 4.00
5 [0.996] Buttermilk Pancakes 7.00 10 [0.993] open 7am - 3pm daily
```
|