aceOfDiamonds commited on
Commit
1597d93
·
1 Parent(s): cb46001

Add facemesh xnnpack fp32 and coreml fp16 exports

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.pte filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: keypoint-detection
4
+ library_name: executorch
5
+ ---
6
+
7
+ # facemesh
8
+
9
+ This repository hosts the **facemesh** 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 model: [MediaPipe Face Mesh, ported to PyTorch](https://github.com/tiqq111/mediapipe_pytorch)
14
+
15
+ A face mesh model regresses 468 3-D landmarks over a single face and scores how
16
+ confident it is that it was shown a face at all. It does not search an image for
17
+ faces: give it a crop that a face detector such as
18
+ [blazeface](https://huggingface.co/software-mansion/react-native-executorch-blazeface)
19
+ already found.
20
+
21
+ ## Variants
22
+
23
+ | Path | Backend | Precision |
24
+ | --- | --- | --- |
25
+ | `xnnpack/facemesh_xnnpack_fp32.pte` | xnnpack | fp32 |
26
+ | `coreml/facemesh_coreml_fp16.pte` | coreml | fp16 |
27
+
28
+ ## Interface
29
+
30
+ ```
31
+ forward: [1, 3, 192, 192] f32
32
+ -> (boxes [1, 4] f32, scores [1] f32, keypoints [1, 468, 4] f32)
33
+ ```
34
+
35
+ The input is RGB, channels-first, normalized to `v / 127.5 - 1`. The outputs
36
+ follow the same shape every keypoint model in this collection publishes, with
37
+ one candidate: `boxes` is the xyxy hull of the mesh in input-pixel units,
38
+ `scores` is the face-presence probability, and each landmark is
39
+ `x, y, confidence, z`. The mesh carries no per-landmark confidence, so that
40
+ column is a constant `1`; `z` is a relative depth on the same scale as `x`,
41
+ negative towards the camera.
42
+
43
+ Landmark order is MediaPipe's canonical face model, so any lip, eye or
44
+ face-oval index list published for MediaPipe Face Mesh applies unchanged.
45
+
46
+ ## Repository structure
47
+
48
+ ```
49
+ config.json 30 B
50
+ coreml/config.json 719 B
51
+ coreml/facemesh_coreml_fp16.pte 1.6 MB
52
+ xnnpack/config.json 721 B
53
+ xnnpack/facemesh_xnnpack_fp32.pte 2.5 MB
54
+ ```
55
+
56
+ ## Compatibility
57
+
58
+ These files are published for the **ExecuTorch v1.4.1** runtime. ExecuTorch
59
+ gives no forward compatibility guarantee, so an older runtime may fail to load
60
+ them.
61
+
62
+ To use them in React Native ExecuTorch, pass the model constant shipped in the
63
+ library's model registry to the corresponding task pipeline. See the
64
+ [documentation](https://docs.swmansion.com/react-native-executorch/docs/fundamentals/downloading-models).
65
+
66
+ To load these files in your own ExecuTorch runtime, read the
67
+ [compatibility note](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md)
68
+ first.
config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "modelName": "facemesh"
3
+ }
coreml/config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
3
+ "model": "facemesh",
4
+ "family": "facemesh",
5
+ "capabilities": [
6
+ "object-detection"
7
+ ],
8
+ "backend": "coreml",
9
+ "license": "apache-2.0",
10
+ "variants": [
11
+ {
12
+ "file": "facemesh_coreml_fp16.pte",
13
+ "precision": "fp16",
14
+ "quantized": false,
15
+ "default": true,
16
+ "methods": {
17
+ "forward": {
18
+ "inputs": [
19
+ {
20
+ "shape": [
21
+ 1,
22
+ 3,
23
+ 192,
24
+ 192
25
+ ],
26
+ "dtype": "float32"
27
+ }
28
+ ],
29
+ "outputs": [
30
+ {
31
+ "name": "boxes",
32
+ "shape": [
33
+ 1,
34
+ 4
35
+ ],
36
+ "dtype": "float32"
37
+ },
38
+ {
39
+ "name": "scores",
40
+ "shape": [
41
+ 1
42
+ ],
43
+ "dtype": "float32"
44
+ },
45
+ {
46
+ "name": "keypoints",
47
+ "shape": [
48
+ 1,
49
+ 468,
50
+ 4
51
+ ],
52
+ "dtype": "float32"
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ ]
59
+ }
coreml/facemesh_coreml_fp16.pte ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4453575c4113b5aef001ae8dc0d89b8cf42b6428ff49cb36f7a933da3a09d3a
3
+ size 1559427
xnnpack/config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
3
+ "model": "facemesh",
4
+ "family": "facemesh",
5
+ "capabilities": [
6
+ "object-detection"
7
+ ],
8
+ "backend": "xnnpack",
9
+ "license": "apache-2.0",
10
+ "variants": [
11
+ {
12
+ "file": "facemesh_xnnpack_fp32.pte",
13
+ "precision": "fp32",
14
+ "quantized": false,
15
+ "default": true,
16
+ "methods": {
17
+ "forward": {
18
+ "inputs": [
19
+ {
20
+ "shape": [
21
+ 1,
22
+ 3,
23
+ 192,
24
+ 192
25
+ ],
26
+ "dtype": "float32"
27
+ }
28
+ ],
29
+ "outputs": [
30
+ {
31
+ "name": "boxes",
32
+ "shape": [
33
+ 1,
34
+ 4
35
+ ],
36
+ "dtype": "float32"
37
+ },
38
+ {
39
+ "name": "scores",
40
+ "shape": [
41
+ 1
42
+ ],
43
+ "dtype": "float32"
44
+ },
45
+ {
46
+ "name": "keypoints",
47
+ "shape": [
48
+ 1,
49
+ 468,
50
+ 4
51
+ ],
52
+ "dtype": "float32"
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ ]
59
+ }
xnnpack/facemesh_xnnpack_fp32.pte ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a552d87acbb4c6053d75958550c3be1666a63f19d2daa9947464a705b39829c7
3
+ size 2461956