-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FaceMesh faceOval points not in order around the face #67
Comments
I took a quick look at this! I think the order of the points is coming directly from the tf.js model. This is the only documentation I could find. We also recently merged #45 which added in bounding boxes and center points for all of the parts. I wonder if we should "re-sort" the faceOval points (or any other parts?) @gohai, is this something that you or any of the DURF students encountered? I made this example many years ago to sort the vertices of a polygon in case it's helpful: https://editor.p5js.org/codingtrain/sketches/GFlV5R9Ur @ziyuan-linn maybe you want to take a look at this? |
Sounds great! I am happy to look into this. I think the original facemesh came with an annotations object but the new one didn't, so we are now manually creating the annotations within ml5. Apparently, we forgot to take the order of the vertices into account. I will take a look at the old tfjs facemesh library to see how they generate the annotations object. In addition to using a vertex-sorting algorithm, we could also consider manually creating a map so we can sort the vertices in linear time. |
Thanks for the report @dano1234! This didn't come up, wasn't attempted, in the summer. Turns out that MediaPipe, the new underlying model, returns points in a particular order, but for creating contours, we can't simply pair them up sequentially. Here is how Google's own implementation gets this done. And this is the source of these pairings. We should amend @ziyuan-linn @shiffman I'd be happy to address this Saturday morning (unless Peter already fixed this while I am writing this message 😅) |
…to account Note: this still doesn't work perfectly for non-contiguous contours, such as lips, but it matches the behavior of Google's demo here: https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_face_mesh This should fix #67.
…to account Note: this still doesn't work perfectly for non-contiguous contours, such as lips, but it matches the behavior of Google's demo here: https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_face_mesh This should fix #67.
…to account Note: this still doesn't work perfectly for non-contiguous contours, such as lips, but it matches the behavior of Google's demo here: https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_face_mesh Fixes: #67.
…to account Note: this still doesn't work perfectly for non-contiguous contours, such as lips, but it matches the behavior of Google's demo here: https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_face_mesh Fixes: #67.
…to account (#68) Note: this still doesn't work perfectly for non-contiguous contours, such as lips, but it matches the behavior of Google's demo here: https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_face_mesh Fixes: #67.
Fantastic! |
Here is a sketch with old ML5 facemesh making a mask
https://editor.p5js.org/dano/sketches/2ULaz2E0v
Here is a sketch with new ML5 facemesh making a mask
https://editor.p5js.org/dano/sketches/-3gKqxIZD
It appears that all the points for the "faceOval" property come in but they are not in a consecutive order around the face.
As ever thanks for this amazing library
The text was updated successfully, but these errors were encountered: