question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update to the latest mediapipe facemesh model for tfjs?

See original GitHub issue

System information

  • TensorFlow.js version (you are using): 3.11.0
  • Are you willing to contribute it (Yes/No): Yes

Describe the feature and the current behavior/state. The latest mediapipe facemesh model supports asymmetric facial expression and has a stunning performance on tracking the mouth area. Here’s a quick demo as of Jan 10 2022: https://codepen.io/mediapipe/full/KKgVaPJ (turn on the refine landmarks option). This is a huge improvement over the current pretrained model on tfjs, which can’t track the facial expression as lively: https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_facemesh. I notice that tfjs landmark detection has been more than 1 year old on npm. Since tfjs landmark detection is using mediapipe facemesh underneath (constructor API attached below), would be great if we can update to the latest model:

const model = await faceLandmarksDetection.load(
    faceLandmarksDetection.SupportedPackages.mediapipeFacemesh)

Will this change the current api? How? No. It should be a swap of the underlying model to the latest one.

Who will benefit with this feature? Everyone who uses the facemesh module with tfjs. As shown in the link above, the model performance is visually much much better with the latest mediapipe facemesh release. Yet the inference time is almost identical.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vladmandiccommented, May 18, 2022

update:

  • new facemesh-detection-full has LOWER resolution (192 vs 256) vs old blazeface-back and generates far noisier output (2304 vs 896 candidates). neither i consider positive, so unless there is clear documentation why its better i’m skipping it.
  • new facemesh-landmarks seems identical in every way to the old one except its quantized to f16 by default
  • new facemesh-landmarks-attention does work without custom kernel ops and it does so almost as fast as standard landmarks model. but model output is totally undocumented (each attention sub-model produces separate output tensor which maps to what?), so will take some time to reverse-engineer it to something useful.
1reaction
vladmandiccommented, Jan 13, 2022

can you clarify?

last published facemesh model is quite old and hasn’t changed

updated model is facemesh-with-attention, but afaik that is tflite only and requires mediapipe’s custom wasm backend for inference as model relies on several custom ops to achieve attention

(specifically, ops are transform_landmarks, transform_tensor_bilinear, landmarks_to_transform_matrix and only implementation for them is C++ based one in mediapipe backend)

or did i miss something and there really is a new facemesh model that i cannot find?

Read more comments on GitHub >

github_iconTop Results From Across the Web

MediaPipe Face Mesh - Google
MediaPipe Face Mesh is a solution that estimates 468 3D face landmarks in real-time even on mobile devices. It employs machine learning (ML)...
Read more >
tensorflow-models/facemesh
MediaPipe Facemesh is a lightweight machine learning pipeline predicting 486 3D facial landmarks to infer the approximate surface geometry of a ...
Read more >
tensorflow-models/facemesh - npm package
The model is designed for front-facing cameras on mobile devices, where faces in view tend to occupy a relatively large fraction of the...
Read more >
Body Segmentation with MediaPipe and TensorFlow.js
Today we are launching two new highly optimized body segmentation models that are both accurate and fast as part of our updated ......
Read more >
TFJS Face Detection missing after version update from 0.0. ...
A new face-landmarks-detection version had released by TensorFlow/tfjs-models on Apr 15. face-landmarks-detection@1.0.1. However, I couldn't get ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found