|
Download README.md from Synaptics/paddle-paddle-tiny: direct link, hf CLI and curl.
- Browser
- Download file 4.06 kB
-
https://huggingface.co/Synaptics/paddle-paddle-tiny/resolve/main/README.md
- Command line
-
hf download hf://Synaptics/paddle-paddle-tiny/README.md
-
curl -L -o README.md https://huggingface.co/Synaptics/paddle-paddle-tiny/resolve/main/README.md
4.06 kB
| 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 | | |
| | `ppocr_det_640x352.vmfb` | Detection (DBNet), static 640×352 bf16 input, for wide/16:9 sources | | |
| | `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 | | |
| ### Two detector sizes | |
| DBNet's stride-32 backbone requires input dims that are multiples of 32. | |
| 800×608 is the default, matched to portrait documents; 640×352 serves wide/16:9 | |
| sources — it is 640×360 rounded *up* to the next multiple of 32, so letterboxed | |
| 16:9 content is padded rather than cropped. Select it in the demo with | |
| `--det-hw 640 352`. | |
| ### 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 | |
| ``` | |