Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -10,29 +10,36 @@ tags:
|
|
| 10 |
---
|
| 11 |
# modnet_portrait_matting — ExecuTorch XNNPACK
|
| 12 |
|
| 13 |
-
`modnet_portrait_matting_xnnpack_fp32.pte` (26.1 MB, fp32, XNNPACK-delegated)
|
| 14 |
-
|
| 15 |
- **Source**: ZHKKKe/MODNet + DavG25/modnet-pretrained-models ckpt
|
| 16 |
- **License**: Apache-2.0
|
| 17 |
- **Input**: [[1, 3, 512, 512]] — RGB [-1,1], 512x512
|
| 18 |
- **Output**: alpha matte [1,1,512,512] 0-1
|
| 19 |
|
| 20 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
| output | shape | max_abs_diff | corr |
|
| 25 |
|--------|-------|--------------|------|
|
| 26 |
-
| 0 | [1, 1, 512, 512] | 1.
|
| 27 |
|
| 28 |
-
|
| 29 |
-
ExecuTorch 69.5 ms vs torch eager 120.2 ms.
|
| 30 |
|
| 31 |
## Conversion
|
| 32 |
|
| 33 |
torch.export -> to_edge_transform_and_lower(XnnpackPartitioner) -> .pte
|
| 34 |
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models))
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
---
|
| 38 |
-
Part of [executorch-models](https://github.com/john-rocky/executorch-models) — a verified .pte zoo for ExecuTorch. Conversion scripts and all models are indexed there.
|
|
|
|
| 10 |
---
|
| 11 |
# modnet_portrait_matting — ExecuTorch XNNPACK
|
| 12 |
|
|
|
|
|
|
|
| 13 |
- **Source**: ZHKKKe/MODNet + DavG25/modnet-pretrained-models ckpt
|
| 14 |
- **License**: Apache-2.0
|
| 15 |
- **Input**: [[1, 3, 512, 512]] — RGB [-1,1], 512x512
|
| 16 |
- **Output**: alpha matte [1,1,512,512] 0-1
|
| 17 |
|
| 18 |
+
## Variants
|
| 19 |
+
|
| 20 |
+
All variants take and return fp32 tensors — swap the `.pte` file, keep your app code.
|
| 21 |
+
|
| 22 |
+
| precision | file | size (MB) | parity vs fp32 eager (worst corr) | Mac median (ms)* |
|
| 23 |
+
|-----------|------|-----------|------------------------------------|------------------|
|
| 24 |
+
| fp32 | `modnet_portrait_matting_xnnpack_fp32.pte` | 26.1 | 1.000000 | 64.9 |
|
| 25 |
+
| fp16 | `modnet_portrait_matting_xnnpack_fp16.pte` | 24.4 | 1.000000 | 107.8 |
|
| 26 |
+
| int8 | `modnet_portrait_matting_xnnpack_int8.pte` | 6.8 | 0.999949 | 46.5 |
|
| 27 |
+
|
| 28 |
+
\*Mac arm64, single process, median of 10 — a reference point for relative cost
|
| 29 |
+
only, not a device number (torch eager fp32 on the same machine: 120.1 ms).
|
| 30 |
|
| 31 |
+
## Verification (executorch 1.4.0, torch 2.13.0)
|
| 32 |
+
|
| 33 |
+
Parity is measured against the fp32 eager model on real image input; `corr` is
|
| 34 |
+
the correlation over all elements of each output tensor.
|
| 35 |
|
| 36 |
| output | shape | max_abs_diff | corr |
|
| 37 |
|--------|-------|--------------|------|
|
| 38 |
+
| 0 | [1, 1, 512, 512] | 1.476e-04 | 1.000000 |
|
| 39 |
|
| 40 |
+
XNNPACK delegate coverage (fp32): 94.7% (302/319 ops); ops left on the portable kernels: `aten._native_batch_norm_legit.no_stats` x16, `aten.expand_copy.default` x1
|
|
|
|
| 41 |
|
| 42 |
## Conversion
|
| 43 |
|
| 44 |
torch.export -> to_edge_transform_and_lower(XnnpackPartitioner) -> .pte
|
| 45 |
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models))
|
|
|
|
|
|
|
|
|
|
|
|