tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.36k stars 1.92k forks source link

Clarification regarding the latest mediapipe facemesh model for tfjs #8359

Closed sitamgithub-MSIT closed 1 week ago

sitamgithub-MSIT commented 4 weeks ago

So, I am using the TensorFlow face_landmarks_detection model with tfjs from this link. My use case is to effectively track iris points for our eye research software. Now, the problem is that our project repository is quite old. Our existing system is fully compatible with model version 0.0.3.

Before (0.0.3) Version:

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

Now I want the version to be updated with the most recent one. That is 1.0.5. I updated the version, and the model loaded successfully, but the predictions produced errors. We can solve the problem, but we need quick solutions for our research paper. Anyway, the point is that I specifically want the updated package for using the most recent model of media pipe face mesh.

After (1.0.5) Version:

const model = faceLandmarksDetection.SupportedModels.MediaPipeFaceMesh;
const detectorConfig = {
  runtime: 'mediapipe', // or 'tfjs'
  solutionPath: 'https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh',
}
const detector = await faceLandmarksDetection.createDetector(model, detectorConfig);

I saw this issue: keeping the API spec the same and just changing the underlying model. So my question is, with the 0.0.3 version, am I using the most recent facemesh model, or has something changed? I have found this face mesh v2 in mediapipe documentation here.

It would be helpful if someone could clarify!

shmishra99 commented 3 weeks ago

Hi @sitamgithub-MSIT ,

I apologize for the delayed response.The package @mediapipe/face_mesh doesn't directly specify a specific MediaPipe FaceMesh version. Instead, it's a wrapper around the MediaPipe FaceMesh model and its dependencies

I've been able to successfully run the face-landmark-detection model using this demo, updating it to use the latest version of face-landmarks-detection 1.0.5.

To build the project, I'm using the following yarn commands:

yarn build-dep
yarn
yarn watch

To help me troubleshoot the issue, could you please share the commands you're using to run your code, as well as any error logs you're encountering? Thank you!

sitamgithub-MSIT commented 3 weeks ago

I am asking that here I see the model card for my media pipe face mesh model: https://storage.googleapis.com/mediapipe-assets/Model%20Card%20MediaPipe%20Face%20Mesh%20V2.pdf

As you can see the date is "MODEL DATE: September 15, 2022". I am using the version 0.0.3 of the face_landmark_detection model. The recent version is 1.0.5. In both cases am I using the same updated model referred to in the model card? Or is there any change regarding that?

shmishra99 commented 3 weeks ago

We currently don't have an official document specifying which MediaPipe FaceMesh model is currently in use. However, based on the version 1.0.5 , it detects 478 3D landmarks, which aligns with the MediaPipe FaceMesh v2 model, whereas the initial model detects 468 3D landmarks, as outlined in this document. Therefore, it seems likely that the model in use is the v2 model.

Please refer to the following snippet for reference:

image

Let me know if i have missed something.

Thank You!!

github-actions[bot] commented 2 weeks ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 1 week ago

This issue was closed due to lack of activity after being marked stale for past 7 days.

google-ml-butler[bot] commented 1 week ago

Are you satisfied with the resolution of your issue? Yes No