Created
January 3, 2021 12:50
-
-
Save sloev/e5e53c27e175d15c30d5e840d0886d43 to your computer and use it in GitHub Desktop.
facemesh detection on static image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- run with | |
| npm install -g http-server | |
| http-server --> | |
| <script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/face-landmarks-detection"></script> | |
| <body> | |
| <img id='img' src='face.jpg' crossorigin="anonymous" /> | |
| </body> | |
| <script> | |
| async function main() { | |
| var img = document.getElementById('img'); | |
| console.log("loading model") | |
| const model = await faceLandmarksDetection.load( | |
| faceLandmarksDetection.SupportedPackages.mediapipeFacemesh); | |
| console.log("predicting faces") | |
| const faces = await model.estimateFaces({ input: img }, false); | |
| return faces | |
| } | |
| main() | |
| .then((data) => { console.log(data) }) | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment