face-api.js | JavaScript API for face detection | Computer Vision library

 by   justadudewhohacks TypeScript Version: 0.22.2 License: MIT

kandi X-RAY | face-api.js Summary

kandi X-RAY | face-api.js Summary

face-api.js is a TypeScript library typically used in Artificial Intelligence, Computer Vision, Tensorflow applications. face-api.js has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              face-api.js has a medium active ecosystem.
              It has 15100 star(s) with 3503 fork(s). There are 335 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 409 open issues and 387 have been closed. On average issues are closed in 98 days. There are 18 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of face-api.js is 0.22.2

            kandi-Quality Quality

              face-api.js has no bugs reported.

            kandi-Security Security

              face-api.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              face-api.js is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              face-api.js releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of face-api.js
            Get all kandi verified functions for this library.

            face-api.js Key Features

            No Key Features are available at this moment for face-api.js.

            face-api.js Examples and Code Snippets

            No Code Snippets are available at this moment for face-api.js.

            Community Discussions

            QUESTION

            Unhandled Rejection (TypeError): Cannot set property 'innerHTML' of undefined
            Asked 2021-May-27 at 06:58

            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:38

            Problem: 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

            Source https://stackoverflow.com/questions/67715945

            QUESTION

            react, how to call a function inside then block before initializing it or any proper way?
            Asked 2021-May-13 at 12:11

            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:11

            You need to change the order of function declaration. You can not call const variables before they were declared.

            Source https://stackoverflow.com/questions/67518994

            QUESTION

            Capture Detected Face Square Only JS
            Asked 2021-Mar-26 at 19:42

            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:42

            You have a canvas. You can save a canvas: How To Save Canvas As An Image With canvas.toDataURL()?

            Assuming detections is an array:

            Source https://stackoverflow.com/questions/66823151

            QUESTION

            problem with importing @tensorflow/tfjs-node while working with face-api.js package (node.js)
            Asked 2021-Mar-21 at 08:25

            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:25

            As 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.

            Source https://stackoverflow.com/questions/65957329

            QUESTION

            face-api.js Use face expression model on hidden video feed
            Asked 2021-Jan-18 at 20:25

            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:25

            I'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:

            Source https://stackoverflow.com/questions/65754574

            QUESTION

            Error with face-api - Error: toNetInput - expected media to be of type HTMLImageElement
            Asked 2020-Nov-24 at 03:41

            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:41

            I 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!

            Source https://stackoverflow.com/questions/64885371

            QUESTION

            Cannot read property 'length' of undefined in face-api.js react
            Asked 2020-Oct-15 at 23:07
            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:07

            The erorr was videoRef.current was null, just need to wrap it in

            Source https://stackoverflow.com/questions/64380025

            QUESTION

            face-api and tensorflow.js not working in browser
            Asked 2020-Aug-30 at 10:34

            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:56

            So, the error you were talking about in the question is:

            Source https://stackoverflow.com/questions/63578210

            QUESTION

            Reactjs - Cannot read the property of undefined
            Asked 2020-Jun-06 at 19:56

            I am trying to render a class component using conditional rendering. The class component has a state value that is by default set to false. In the class, a function called start() performs some operation and based on the results, it will call a function verifyTheIdentity() that has setState(). But I am not able to call the verifyTheIdentity() from start().

            ...

            ANSWER

            Answered 2020-Jun-06 at 18:18

            First of all, you do not need bind at all, if you use arrow function.

            Source https://stackoverflow.com/questions/62235987

            QUESTION

            Error in my script SyntaxError: missing ) after argument list
            Asked 2020-May-26 at 04:49

            I have this script and he return this error in console SyntaxError: missing ) after argument list but i dont found where is the error in my code.

            ...

            ANSWER

            Answered 2020-May-26 at 04:45

            At the end of all your faceapi.nets. lines inside the big Promise.add, you end all the lines with just a comma rather than ending with ),. Since you are calling loadFromUri, you need to close the function before moving onto the next one.

            Source https://stackoverflow.com/questions/62014815

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install face-api.js

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/justadudewhohacks/face-api.js.git

          • CLI

            gh repo clone justadudewhohacks/face-api.js

          • sshUrl

            git@github.com:justadudewhohacks/face-api.js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Computer Vision Libraries

            opencv

            by opencv

            tesseract

            by tesseract-ocr

            face_recognition

            by ageitgey

            tesseract.js

            by naptha

            Detectron

            by facebookresearch

            Try Top Libraries by justadudewhohacks

            opencv4nodejs

            by justadudewhohacksC++

            face-recognition.js

            by justadudewhohacksJavaScript

            websocket-chat

            by justadudewhohacksJavaScript

            tfjs-tiny-yolov2

            by justadudewhohacksTypeScript

            opencv-electron

            by justadudewhohacksHTML