Re-export under the get_model_schema contract; restructure to the MODEL_SPEC layout
Browse files- .gitattributes +3 -0
- README.md +22 -8
- config.json +2 -3
- coreml/config.json +55 -0
- coreml/pp_doclayout_v3_coreml_fp16.pte +3 -0
- vulkan/config.json +55 -0
- vulkan/pp_doclayout_v3_vulkan_fp16.pte +3 -0
- xnnpack/config.json +55 -0
- xnnpack/pp_doclayout_v3_xnnpack_fp32.pte +3 -0
.gitattributes
CHANGED
|
@@ -36,3 +36,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
PP-DocLayoutV3_coreml.pte filter=lfs diff=lfs merge=lfs -text
|
| 37 |
PP-DocLayoutV3_vulkan.pte filter=lfs diff=lfs merge=lfs -text
|
| 38 |
PP-DocLayoutV3_xnnpack.pte filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
PP-DocLayoutV3_coreml.pte filter=lfs diff=lfs merge=lfs -text
|
| 37 |
PP-DocLayoutV3_vulkan.pte filter=lfs diff=lfs merge=lfs -text
|
| 38 |
PP-DocLayoutV3_xnnpack.pte filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
coreml/pp_doclayout_v3_coreml_fp16.pte filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
vulkan/pp_doclayout_v3_vulkan_fp16.pte filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
xnnpack/pp_doclayout_v3_xnnpack_fp32.pte filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -3,6 +3,7 @@ license: apache-2.0
|
|
| 3 |
---
|
| 4 |
|
| 5 |
# Introduction
|
|
|
|
| 6 |
This repository hosts [PaddleOCR PP-DocLayoutV3](https://huggingface.co/PaddlePaddle/PP-DocLayoutV3_safetensors),
|
| 7 |
an RT-DETR-based **document layout detector** (~33M params), for the
|
| 8 |
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library,
|
|
@@ -17,29 +18,39 @@ If you'd like to run these models in your own ExecuTorch runtime, refer to the
|
|
| 17 |
The `.pte` is a pure tensor→tensor function; pre-processing (resize, normalize) and the final
|
| 18 |
score threshold are the client's job.
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
## Output contract
|
| 21 |
|
| 22 |
-
A single **fixed-shape** method `forward`
|
| 23 |
-
|
| 24 |
-
graph** — outputs are ready-to-threshold:
|
| 25 |
|
| 26 |
```
|
| 27 |
-
in [1, 3, 800, 800] # RGB,
|
| 28 |
out boxes [300, 4] # (x1, y1, x2, y2) in 800×800 model-input pixel space
|
| 29 |
scores [300] # max-class sigmoid score per query
|
| 30 |
classes [300] # float class index per query (argmax)
|
| 31 |
```
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
PP-DocLayoutV3 is a **DETR set-prediction** model → **no NMS**. All 300 queries are returned;
|
| 34 |
post-processing is just: keep rows with `score ≥ threshold`, scale boxes from the 800×800
|
| 35 |
input space to your image, and map `classes[i]` through `labels.json` (index → label).
|
| 36 |
|
| 37 |
### Classes (25)
|
| 38 |
|
| 39 |
-
`abstract, algorithm, aside_text, chart, content,
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
`labels.json`
|
| 43 |
|
| 44 |
## Backends, sizes & latency (warm)
|
| 45 |
|
|
@@ -62,3 +73,6 @@ the compatibility note in the
|
|
| 62 |
[ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md).
|
| 63 |
If you work with React Native ExecuTorch, the library constants guarantee compatibility with the
|
| 64 |
runtime used behind the scenes.
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
|
| 5 |
# Introduction
|
| 6 |
+
|
| 7 |
This repository hosts [PaddleOCR PP-DocLayoutV3](https://huggingface.co/PaddlePaddle/PP-DocLayoutV3_safetensors),
|
| 8 |
an RT-DETR-based **document layout detector** (~33M params), for the
|
| 9 |
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library,
|
|
|
|
| 18 |
The `.pte` is a pure tensor→tensor function; pre-processing (resize, normalize) and the final
|
| 19 |
score threshold are the client's job.
|
| 20 |
|
| 21 |
+
## Repository layout
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
<backend>/config.json # per-backend spec
|
| 25 |
+
<backend>/pp_doclayout_v3_<backend>_<precision>.pte
|
| 26 |
+
labels.json # index -> class name, matching the `classes` output
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
## Output contract
|
| 30 |
|
| 31 |
+
A single **fixed-shape** method `forward`, declared in `config.json`. The RT-DETR box decode is
|
| 32 |
+
**baked into the graph** — outputs are ready to threshold:
|
|
|
|
| 33 |
|
| 34 |
```
|
| 35 |
+
in [1, 3, 800, 800] # RGB, normalized by the client to [0, 1] (x/255)
|
| 36 |
out boxes [300, 4] # (x1, y1, x2, y2) in 800×800 model-input pixel space
|
| 37 |
scores [300] # max-class sigmoid score per query
|
| 38 |
classes [300] # float class index per query (argmax)
|
| 39 |
```
|
| 40 |
|
| 41 |
+
Every dimension is static, so this model carries **no `get_model_schema` overrides** — a
|
| 42 |
+
client reads its signature straight from ExecuTorch's `MethodMeta`.
|
| 43 |
+
|
| 44 |
PP-DocLayoutV3 is a **DETR set-prediction** model → **no NMS**. All 300 queries are returned;
|
| 45 |
post-processing is just: keep rows with `score ≥ threshold`, scale boxes from the 800×800
|
| 46 |
input space to your image, and map `classes[i]` through `labels.json` (index → label).
|
| 47 |
|
| 48 |
### Classes (25)
|
| 49 |
|
| 50 |
+
`abstract, algorithm, aside_text, chart, content, display_formula, doc_title, figure_title,
|
| 51 |
+
footer, footer_image, footnote, formula_number, header, header_image, image, inline_formula,
|
| 52 |
+
number, paragraph_title, reference, reference_content, seal, table, text, vertical_text,
|
| 53 |
+
vision_footnote` — `labels.json` is the authoritative index→label map.
|
| 54 |
|
| 55 |
## Backends, sizes & latency (warm)
|
| 56 |
|
|
|
|
| 73 |
[ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md).
|
| 74 |
If you work with React Native ExecuTorch, the library constants guarantee compatibility with the
|
| 75 |
runtime used behind the scenes.
|
| 76 |
+
|
| 77 |
+
These models were exported with ExecuTorch 1.3.1 and **no forward compatibility** is
|
| 78 |
+
guaranteed; older runtimes may not load them.
|
config.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
{
|
| 2 |
-
"
|
| 3 |
-
|
| 4 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"modelName": "pp-doclayout-v3"
|
| 3 |
+
}
|
|
|
coreml/config.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
|
| 3 |
+
"model": "pp_doclayout_v3",
|
| 4 |
+
"family": "paddleocr",
|
| 5 |
+
"capabilities": [
|
| 6 |
+
"object-detection"
|
| 7 |
+
],
|
| 8 |
+
"backend": "coreml",
|
| 9 |
+
"license": "apache-2.0",
|
| 10 |
+
"variants": [
|
| 11 |
+
{
|
| 12 |
+
"file": "pp_doclayout_v3_coreml_fp16.pte",
|
| 13 |
+
"precision": "fp16",
|
| 14 |
+
"quantized": false,
|
| 15 |
+
"default": true,
|
| 16 |
+
"size_bytes": 91470588,
|
| 17 |
+
"methods": {
|
| 18 |
+
"forward": {
|
| 19 |
+
"inputs": [
|
| 20 |
+
{
|
| 21 |
+
"shape": [
|
| 22 |
+
1,
|
| 23 |
+
3,
|
| 24 |
+
800,
|
| 25 |
+
800
|
| 26 |
+
],
|
| 27 |
+
"dtype": "float32"
|
| 28 |
+
}
|
| 29 |
+
],
|
| 30 |
+
"outputs": [
|
| 31 |
+
{
|
| 32 |
+
"shape": [
|
| 33 |
+
300,
|
| 34 |
+
4
|
| 35 |
+
],
|
| 36 |
+
"dtype": "float32"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"shape": [
|
| 40 |
+
300
|
| 41 |
+
],
|
| 42 |
+
"dtype": "float32"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"shape": [
|
| 46 |
+
300
|
| 47 |
+
],
|
| 48 |
+
"dtype": "float32"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
]
|
| 55 |
+
}
|
coreml/pp_doclayout_v3_coreml_fp16.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8bc08d24ebe1c17fc46ca57e6c7626ebaa4453299a0c99bd9ac2e8a452f1a6e6
|
| 3 |
+
size 91470588
|
vulkan/config.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
|
| 3 |
+
"model": "pp_doclayout_v3",
|
| 4 |
+
"family": "paddleocr",
|
| 5 |
+
"capabilities": [
|
| 6 |
+
"object-detection"
|
| 7 |
+
],
|
| 8 |
+
"backend": "vulkan",
|
| 9 |
+
"license": "apache-2.0",
|
| 10 |
+
"variants": [
|
| 11 |
+
{
|
| 12 |
+
"file": "pp_doclayout_v3_vulkan_fp16.pte",
|
| 13 |
+
"precision": "fp16",
|
| 14 |
+
"quantized": false,
|
| 15 |
+
"default": true,
|
| 16 |
+
"size_bytes": 66608642,
|
| 17 |
+
"methods": {
|
| 18 |
+
"forward": {
|
| 19 |
+
"inputs": [
|
| 20 |
+
{
|
| 21 |
+
"shape": [
|
| 22 |
+
1,
|
| 23 |
+
3,
|
| 24 |
+
800,
|
| 25 |
+
800
|
| 26 |
+
],
|
| 27 |
+
"dtype": "float32"
|
| 28 |
+
}
|
| 29 |
+
],
|
| 30 |
+
"outputs": [
|
| 31 |
+
{
|
| 32 |
+
"shape": [
|
| 33 |
+
300,
|
| 34 |
+
4
|
| 35 |
+
],
|
| 36 |
+
"dtype": "float32"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"shape": [
|
| 40 |
+
300
|
| 41 |
+
],
|
| 42 |
+
"dtype": "float32"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"shape": [
|
| 46 |
+
300
|
| 47 |
+
],
|
| 48 |
+
"dtype": "float32"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
]
|
| 55 |
+
}
|
vulkan/pp_doclayout_v3_vulkan_fp16.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f2f053760bedc659c4d2b23c9e6096ddac07f4557419d953666c3cbf4d3f4fb6
|
| 3 |
+
size 66608642
|
xnnpack/config.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
|
| 3 |
+
"model": "pp_doclayout_v3",
|
| 4 |
+
"family": "paddleocr",
|
| 5 |
+
"capabilities": [
|
| 6 |
+
"object-detection"
|
| 7 |
+
],
|
| 8 |
+
"backend": "xnnpack",
|
| 9 |
+
"license": "apache-2.0",
|
| 10 |
+
"variants": [
|
| 11 |
+
{
|
| 12 |
+
"file": "pp_doclayout_v3_xnnpack_fp32.pte",
|
| 13 |
+
"precision": "fp32",
|
| 14 |
+
"quantized": false,
|
| 15 |
+
"default": true,
|
| 16 |
+
"size_bytes": 131820160,
|
| 17 |
+
"methods": {
|
| 18 |
+
"forward": {
|
| 19 |
+
"inputs": [
|
| 20 |
+
{
|
| 21 |
+
"shape": [
|
| 22 |
+
1,
|
| 23 |
+
3,
|
| 24 |
+
800,
|
| 25 |
+
800
|
| 26 |
+
],
|
| 27 |
+
"dtype": "float32"
|
| 28 |
+
}
|
| 29 |
+
],
|
| 30 |
+
"outputs": [
|
| 31 |
+
{
|
| 32 |
+
"shape": [
|
| 33 |
+
300,
|
| 34 |
+
4
|
| 35 |
+
],
|
| 36 |
+
"dtype": "float32"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"shape": [
|
| 40 |
+
300
|
| 41 |
+
],
|
| 42 |
+
"dtype": "float32"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"shape": [
|
| 46 |
+
300
|
| 47 |
+
],
|
| 48 |
+
"dtype": "float32"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
]
|
| 55 |
+
}
|
xnnpack/pp_doclayout_v3_xnnpack_fp32.pte
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:994dfa66134a8c111473601d971dfc50199cc4bdf25b60d34540aebeeba7f066
|
| 3 |
+
size 131820160
|