face-api | powered Face Detection & Rotation Tracking | Computer Vision library
kandi X-RAY | face-api Summary
kandi X-RAY | face-api Summary
FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of face-api
face-api Key Features
face-api Examples and Code Snippets
Community Discussions
Trending Discussions on face-api
QUESTION
I'm using ReactJs to execute face-api-js
for face recognition. In the console log I'm getting the values but it is not displaying in the live video.
Unhandled Rejection (TypeError): Cannot set property 'innerHTML' of undefined
this is the error I am getting under the function handleVideoOnPlay
I'm new to the react framework it would be great if someone helps me out.
...ANSWER
Answered 2021-May-27 at 05:38Problem:
Cannot set property 'innerHTML' of undefined
Reason: canvasRef.current
becomes undefined
Before continuing, I found one thing, the line
has Ref, it should be
ref
Now,
I guess you should make use of useEffect()
as follows
QUESTION
I've build an javascript function with face-api.js for my react component which will return/console me the width and height of face detector box. I tried console.log in few places it seems working fine till the models(face-recognition-model).
But when I write async function for face detector to detect face and console. It gives me error-
...ANSWER
Answered 2021-May-13 at 12:11You need to change the order of function declaration. You can not call const
variables before they were declared.
QUESTION
I check 20 other posts of people that keep getting this error, and none of em helped me solve my problem.
I am trying to load a file into a TorchNeuralNet, to use for face verification.
...ANSWER
Answered 2021-Apr-19 at 20:50It was the parser also OpenFace doesnt work well with Windows. Tried some Docker stuff but didnt work. Transitioned to dlib and opencv and im making progress.
QUESTION
I'm running a face detection model via JS in the webcam, it recognises the face and draws the box correctly. How can I then go about saving the detected face only as an image locally to my computer?
Im grateful for any help! Im stuck!
The code (from face-api.js) is as follows:
JavaScript
...ANSWER
Answered 2021-Mar-26 at 19:42You have a canvas. You can save a canvas: How To Save Canvas As An Image With canvas.toDataURL()?
Assuming detections
is an array:
QUESTION
i use @tensorflow/tfjs-node package for face-api.js package to speed up things (as they said ) that is my code :
...ANSWER
Answered 2021-Mar-21 at 08:25As explained in this github issue
The version of face-api.js you are using is not compatible with tfjs 2.0+ or 3.0+, only obsolete 1.x. Why it worked before you added tfjs-node? because face-api.js actually includes bundled version of tfjs-core 1.x. Once you added tfjs-node, it overrode global tf namespace, but its a much newer version and not compatible.
You must install obsolete tfjs-node 1.x OR follow the pointers they give to use a newer port of face-api.js that supports TF 2.0.
QUESTION
Just found out about the awesome face-api.js repo, and I'm having a great time using the face expressions API. Maybe because I was smiling too much (for the testing).
Anyway, In my app, I want to check if the user is smiling but without displaying the camera video on the screen.
For now, I can check if the user is smiling or not with a pretty good accuracy, but the video has to be on my screen.
How can I remove the video from the screen?
Here is the js code:
...ANSWER
Answered 2021-Jan-18 at 20:25I'm here to answer my own question just in case someone needs it in the future.
The obvious answer should be to add a "display: none;" to the video tag. However, this doesn't work somehow.
Instead, I created the element in javascript, appended it to the DOM, and changed its display to "none", and it worked.
Here is the code that made it work:
QUESTION
My name is Gabriel and I'm using face-api.js to apply FaceRecognition on my final essay, on my way to graduate.
With the objective of trying the face-api and understand how it works, I created the following test.js:
...ANSWER
Answered 2020-Nov-24 at 03:41I did post an Issue to github Face-API page, and there I was able to found a solution, so, if anyone would like to see it: https://github.com/justadudewhohacks/face-api.js/issues/729 Thanks for your time!
QUESTION
import React, { useRef, useState, useEffect } from 'react';
import * as faceapi from 'face-api.js';
function App() {
const videoRef = useRef(null);
const canvasRef = useRef(null);
useEffect(() => {
const loadModels = async () => {
try {
const MODEL_URL = '/models'
Promise.all([
faceapi.nets.tinyFaceDetector.loadFromUri(MODEL_URL),
faceapi.nets.faceLandmark68Net.loadFromUri(MODEL_URL),
faceapi.nets.faceRecognitionNet.loadFromUri(MODEL_URL),
faceapi.nets.faceExpressionNet.loadFromUri(MODEL_URL),
]).then(startVideo())
} catch (error) {
console.error(error)
}
}
loadModels();
}, [])
const startVideo = async () => {
try {
let stream = null;
stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
videoRef.current.srcObject = stream;
} catch (error) {
console.error(error)
}
}
const handleVideoOnPlay = () => {
setInterval(async () => {
const detections = await faceapi.
detectAllFaces(videoRef.current, new faceapi.TinyFaceDetectorOptions())
.withFaceLandmarks()
.withFaceExpressions()
}, 100)
}
return (
);
}
export default App;
...ANSWER
Answered 2020-Oct-15 at 23:07The erorr was videoRef.current was null, just need to wrap it in
QUESTION
I'm using Azure's cognitive service Face API to analyze images. I'd gotten it working earlier using url links to images without issue, but I'm trying to get it working with local images. I'd found a question asked that's exactly what I'm looking for with a request.post
, but I'm trying to get it working with axios.
My code:
ANSWER
Answered 2020-Sep-21 at 02:06If you want to run Axios
in the node environment, we should use Stream, Buffer
as request body data. For more details, please refer to here.
For example
QUESTION
I'm trying to run this example in the browser
https://justadudewhohacks.github.io/face-api.js/docs/index.html#getting-started-browser
Specifically this code here
...ANSWER
Answered 2020-Aug-28 at 12:56So, the error you were talking about in the question is:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install face-api
FaceAPI ships with several pre-build versions of the library:. Bundled TFJS can be used directly via export: faceapi.tf. Reason for additional nobundle version is if you want to include a specific version of TFJS and not rely on pre-packaged one. FaceAPI is compatible with TFJS 2.0+ and TFJS 3.0+. All versions include sourcemap.
dist/face-api.js: IIFE format for client-side Browser execution with TFJS pre-bundled
dist/face-api.esm.js: ESM format for client-side Browser execution with TFJS pre-bundled
dist/face-api.esm-nobundle.js: ESM format for client-side Browser execution without TFJS pre-bundled
dist/face-api.node.js: CommonJS format for server-side NodeJS execution without TFJS pre-bundled
dist/face-api.node-gpu.js: CommonJS format for server-side NodeJS execution without TFJS pre-bundled and optimized for CUDA GPU acceleration
If you want to do a full rebuild, either download npm module. or clone a git project.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page