--- license: apache-2.0 pipeline_tag: keypoint-detection library_name: executorch --- # facemesh This repository hosts the **facemesh** models exported for the [React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library as ExecuTorch `.pte` programs, ready to run on device. Upstream model: [MediaPipe Face Mesh, ported to PyTorch](https://github.com/tiqq111/mediapipe_pytorch) A face mesh model regresses 468 3-D landmarks over a single face and scores how confident it is that it was shown a face at all. It does not search an image for faces: give it a crop that a face detector such as [blazeface](https://huggingface.co/software-mansion/react-native-executorch-blazeface) already found. ## Variants | Path | Backend | Precision | | --- | --- | --- | | `xnnpack/facemesh_xnnpack_fp32.pte` | xnnpack | fp32 | | `coreml/facemesh_coreml_fp16.pte` | coreml | fp16 | xnnpack is fp32 on purpose: an int8 build ran 0.78x as fast on a Galaxy S26 Ultra and 0.80x on an iPhone 16 Pro while drifting up to 6.3 px. ## Interface ``` forward: [1, 3, 192, 192] f32 -> (boxes [1, 4] f32, scores [1] f32, keypoints [1, 468, 4] f32) ``` The input is RGB, channels-first, normalized to `v / 127.5 - 1`. The outputs follow the same shape every keypoint model in this collection publishes, with one candidate: `boxes` is the xyxy hull of the mesh in input-pixel units, `scores` is the face-presence probability, and each landmark is `x, y, confidence, z`. The mesh carries no per-landmark confidence, so that column is a constant `1`; `z` is a relative depth on the same scale as `x`, negative towards the camera. Landmark order is MediaPipe's canonical face model, so any lip, eye or face-oval index list published for MediaPipe Face Mesh applies unchanged. ## Repository structure ``` config.json 30 B coreml/config.json 719 B coreml/facemesh_coreml_fp16.pte 1.6 MB xnnpack/config.json 721 B xnnpack/facemesh_xnnpack_fp32.pte 2.5 MB ``` ## Compatibility These files are published for the **ExecuTorch v1.4.1** runtime. ExecuTorch gives no forward compatibility guarantee, so an older runtime may fail to load them. To use them in React Native ExecuTorch, pass the model constant shipped in the library's model registry to the corresponding task pipeline. See the [documentation](https://docs.swmansion.com/react-native-executorch/docs/fundamentals/downloading-models). To load these files in your own ExecuTorch runtime, read the [compatibility note](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md) first.