![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
tensorflow-models-face-landmarks-detection
Advanced tools
This package provides models for running real-time face detection and landmark tracking.
Currently, we provide 1 model option:
MediaPipe Facemesh can detect multiple faces, each face contains 468 keypoints.
More background information about the package, as well as its performance characteristics on different datasets, can be found here: Model Card. The facemesh package optionally loads an iris detection model, whose model card can be found here: Model Card.
In general there are two steps:
You first create a detector by choosing one of the models from SupportedModels
, including MediaPipeFaceMesh
.
For example:
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);
Then you can use the detector to detect faces.
const faces = await detector.estimateFaces(image);
The returned face list contains detected faces for each faces in the image. If the model cannot detect any faces, the list will be empty.
For each face, it contains a bounding box of the detected face, as well as an array of keypoints. MediaPipeFaceMesh returns 468 keypoints. Each keypoint contains x and y, as well as a name.
Example output:
[
{
box: {
xMin: 304.6476503248806,
xMax: 502.5079975897382,
yMin: 102.16298762367356,
yMax: 349.035215984403,
width: 197.86034726485758,
height: 246.87222836072945
},
keypoints: [
{x: 406.53152857172876, y: 256.8054528661723, z: 10.2, name: "lips"},
{x: 406.544237446397, y: 230.06933367750395, z: 8},
...
],
}
]
The box
represents the bounding box of the face in the image pixel space, with xMin
, xMax
denoting the x-bounds, yMin
, yMax
denoting the y-bounds, and width
, height
are the dimensions of the bounding box.
For the keypoints
, x and y represent the actual keypoint position in the image pixel space. z represents the depth with the center of the head being the origin, and the smaller the value the closer the keypoint is to the camera. The magnitude of z uses roughly the same scale as x.
The name provides a label for some keypoint, such as 'lips', 'leftEye', etc. Note that not each keypoint will have a label.
Refer to each model's documentation for specific configurations for the model and their performance.
MediaPipeFaceMesh MediaPipe Documentation
MediaPipeFaceMesh TFJS Documentation
See the diagram below for what those keypoints are and their index in the array.
You may reference the demos for code examples. Details for how to run the demos
are included in the demos/
folder.
FAQs
Pretrained face landmarks detection model
The npm package tensorflow-models-face-landmarks-detection receives a total of 3 weekly downloads. As such, tensorflow-models-face-landmarks-detection popularity was classified as not popular.
We found that tensorflow-models-face-landmarks-detection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.