Apply the model card standard
Browse files
README.md
CHANGED
|
@@ -4,80 +4,54 @@ pipeline_tag: image-to-text
|
|
| 4 |
library_name: executorch
|
| 5 |
---
|
| 6 |
|
| 7 |
-
#
|
| 8 |
|
| 9 |
-
This repository hosts
|
| 10 |
-
[
|
| 11 |
-
|
| 12 |
-
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library,
|
| 13 |
-
exported to `.pte` for the **ExecuTorch** runtime (XNNPACK, CoreML and Vulkan backends).
|
| 14 |
|
| 15 |
-
|
| 16 |
-
[official documentation](https://pytorch.org/executorch/stable/index.html) for setup instructions.
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
(resize, normalize, DBNet box decode, perspective crop, CTC decode) is the client's job and is
|
| 22 |
-
driven by `config.json`. One model covers **all languages** (18 709-entry multilingual charset).
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
``
|
| 31 |
-
|
| 32 |
-
## Methods & I/O contract
|
| 33 |
-
|
| 34 |
-
| method | input | output |
|
| 35 |
-
|---|---|---|
|
| 36 |
-
| `detect` (DBNet) | `[1,3,H,W]` f32 RGB, **ImageNet-normalized by the client**: `(x/255 β mean)/std`, `mean=[0.485,0.456,0.406]`, `std=[0.229,0.224,0.225]` | `[1,1,H,W]` probability map (sigmoid baked) |
|
| 37 |
-
| `recognize` (SVTR) | `[1,3,48,W]` f32 RGB, client-normalized `(x/255 β 0.5)/0.5` | `[1,W/8,18710]` probs (softmax baked); `charset[i]` β logit `i+1`, blank = 0 |
|
| 38 |
-
|
| 39 |
-
**Nothing is baked for input normalization** β the client normalizes before calling.
|
| 40 |
-
Note the two methods use *different* norms (ImageNet for detect, `0.5/0.5` for recognize).
|
| 41 |
-
|
| 42 |
-
## Shape discovery (`get_model_schema`)
|
| 43 |
|
| 44 |
-
|
| 45 |
-
`ModelSpec` string: per method, the input and output parameter specs (dtype plus a domain per
|
| 46 |
-
dimension β `constant`, `range` with `{min, max, step}`, or `enum` with explicit `choices`) and
|
| 47 |
-
the runtime constraints the method declares over its dimensions. Methods absent from the JSON
|
| 48 |
-
are fully static and described by ExecuTorch's own `MethodMeta`. The schema is validated
|
| 49 |
-
against
|
| 50 |
-
[`config.schema.json`'s `ModelSpec`](https://huggingface.co/software-mansion/react-native-executorch-spec)
|
| 51 |
-
counterpart in the library at load time. The older `get_dynamic_dims_<m>` / `get_enum_shapes_<m>`
|
| 52 |
-
companion methods are **gone** β everything they carried now lives in this one document.
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
-
##
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
| `coreml` | Apple ANE | weight-only int8, enumerated | weight-only int8, enumerated | ~12β15 ms / ~2 ms (Apple M-series ANE) |
|
| 69 |
-
| `vulkan` | Android GPU | fp16, true-dynamic (resize) | fp32 on **XNNPACK** (mixed-delegate) | ~73 ms / ~27 ms (Galaxy S24, Xclipse 940) |
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
> 0.994 against eager fp32 from 640 to 1280 square, best at 1280), and on-device the int8 build
|
| 79 |
-
> returns the same detections about 15% faster end to end at 23.9 MB instead of 31.1 MB. The
|
| 80 |
-
> SVTR recognizer stays fp32: int8 is lossy on its attention stack.
|
| 81 |
|
| 82 |
## CoreML notes (iOS)
|
| 83 |
|
|
@@ -87,14 +61,8 @@ whatever width it picks instead of inferring a ratio.
|
|
| 87 |
- First-ever load on a device triggers a one-time per-shape ANE specialization (OS-cached
|
| 88 |
afterwards) β warm each model once after install.
|
| 89 |
|
| 90 |
-
##
|
| 91 |
-
|
| 92 |
-
If you intend to use these models outside of React Native ExecuTorch, make sure your runtime is
|
| 93 |
-
compatible with the **ExecuTorch** version used to export the `.pte` files. For more details, see
|
| 94 |
-
the compatibility note in the
|
| 95 |
-
[ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md).
|
| 96 |
-
If you work with React Native ExecuTorch, the library constants guarantee compatibility with the
|
| 97 |
-
runtime used behind the scenes.
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
| 4 |
library_name: executorch
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# pp-ocrv6
|
| 8 |
|
| 9 |
+
This repository hosts the **pp-ocrv6** models exported for the
|
| 10 |
+
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch)
|
| 11 |
+
library as ExecuTorch `.pte` programs, ready to run on device.
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
Upstream models:
|
|
|
|
| 14 |
|
| 15 |
+
- [PaddleOCR PP-OCRv6](https://github.com/PaddlePaddle/PaddleOCR)
|
| 16 |
+
- [detector](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_det_safetensors)
|
| 17 |
+
- [recognizer](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_rec_safetensors)
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
## Variants
|
| 20 |
|
| 21 |
+
| Path | Backend | Precision |
|
| 22 |
+
| --- | --- | --- |
|
| 23 |
+
| `coreml/pp_ocrv6_coreml_int8.pte` | coreml | int8 |
|
| 24 |
+
| `vulkan/pp_ocrv6_vulkan_fp16.pte` | vulkan | fp16 |
|
| 25 |
+
| `xnnpack/pp_ocrv6_xnnpack_fp32.pte` | xnnpack | fp32 |
|
| 26 |
+
| `xnnpack/pp_ocrv6_xnnpack_int8.pte` | xnnpack | int8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
## Repository structure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
```
|
| 31 |
+
charset.json 128 kB
|
| 32 |
+
config.json 30 B
|
| 33 |
+
coreml/config.json 1.3 kB
|
| 34 |
+
coreml/pp_ocrv6_coreml_int8.pte 7.9 MB
|
| 35 |
+
vulkan/config.json 1.3 kB
|
| 36 |
+
vulkan/pp_ocrv6_vulkan_fp16.pte 25.0 MB
|
| 37 |
+
xnnpack/config.json 2.3 kB
|
| 38 |
+
xnnpack/pp_ocrv6_xnnpack_fp32.pte 29.6 MB
|
| 39 |
+
xnnpack/pp_ocrv6_xnnpack_int8.pte 22.8 MB
|
| 40 |
+
```
|
| 41 |
|
| 42 |
+
## Compatibility
|
| 43 |
|
| 44 |
+
These files are published for the **ExecuTorch v1.4.1** runtime. ExecuTorch
|
| 45 |
+
gives no forward compatibility guarantee, so an older runtime may fail to load
|
| 46 |
+
them.
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
To use them in React Native ExecuTorch, pass the model constant shipped in the
|
| 49 |
+
library's model registry to the corresponding task pipeline. See the
|
| 50 |
+
[documentation](https://docs.swmansion.com/react-native-executorch/docs/fundamentals/loading-models).
|
| 51 |
|
| 52 |
+
To load these files in your own ExecuTorch runtime, read the
|
| 53 |
+
[compatibility note](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md)
|
| 54 |
+
first.
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
## CoreML notes (iOS)
|
| 57 |
|
|
|
|
| 61 |
- First-ever load on a device triggers a one-time per-shape ANE specialization (OS-cached
|
| 62 |
afterwards) β warm each model once after install.
|
| 63 |
|
| 64 |
+
## Model details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
The recognizer's output is a probability distribution over the charset with
|
| 67 |
+
softmax already baked in. Index `0` is the CTC blank, so `charset[i]`
|
| 68 |
+
corresponds to logit `i + 1`.
|