| --- |
| license: apache-2.0 |
| --- |
| |
| # Introduction |
|
|
| This repository hosts [PaddleOCR PP-OCRv6](https://github.com/PaddlePaddle/PaddleOCR) (the |
| [detector](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_det_safetensors) + |
| [recognizer](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_rec_safetensors)) for the |
| [React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library, |
| exported to `.pte` for the **ExecuTorch** runtime (XNNPACK, CoreML and Vulkan backends). |
|
|
| If you'd like to run these models in your own ExecuTorch runtime, refer to the |
| [official documentation](https://pytorch.org/executorch/stable/index.html) for setup instructions. |
|
|
| PP-OCRv6 is the **primary** OCR pipeline — smallest and fastest. It ships as **one fused `.pte`** per backend, using **static bucketed |
| methods**. The `.pte` is a pure tensor→tensor function; all pre/post-processing (resize, |
| normalize, DBNet box decode, perspective crop, CTC decode) is the client's job and is driven by |
| `config.json`. One model covers **all languages** (18 709-entry multilingual charset). |
|
|
| ## Backends |
|
|
| | backend | target | detect | recognize | |
| |---|---|---|---| |
| | `xnnpack` | CPU | int8 (DBNet) | fp32 (SVTR) | |
| | `coreml` | Apple ANE | weight-only int8 | weight-only int8 | |
| | `vulkan` | Android GPU | fp16 (GPU) | fp32 on **XNNPACK** (mixed-delegate) | |
|
|
| > **Vulkan is mixed-delegate**: DBNet detects on the GPU, but the SVTR recognizer runs on the |
| > CPU (XNNPACK). int8 SVTR is lossy on the 18 709-token vocab — so the recognizer stays fp32 on CPU for correctness. |
|
|
| ## Buckets |
|
|
| `is_bucketed()` reports `[detect sides ; recognize widths]`: |
|
|
| - **detect** (square sides ÷32): `640, 960, 1280` → `detect_640 / detect_960 / detect_1280` |
| (+ a `1280×640` portrait method `detect_640x1280`) |
| - **recognize** (widths ÷8, height 48): `160, 320, 480, 640` → `recognize_160 … recognize_640` |
|
|
| Detector input is RGB, normalized `(x/255 − 0.5)/0.5`. |
|
|
| ## Compatibility |
|
|
| If you intend to use these models outside of React Native ExecuTorch, make sure your runtime is |
| compatible with the **ExecuTorch** version used to export the `.pte` files. For more details, see |
| the compatibility note in the |
| [ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md). |
| If you work with React Native ExecuTorch, the library constants guarantee compatibility with the |
| runtime used behind the scenes. |
|
|