Giter VIP home page Giter VIP logo

face-detection-javascript's Introduction

IMPORTANT: Bug Fixes

navigator.getUserMedia

navigator.getUserMedia is now deprecated and is replaced by navigator.mediaDevices.getUserMedia. To fix this bug replace all versions of navigator.getUserMedia with navigator.mediaDevices.getUserMedia

Low-end Devices Bug

The video eventListener for play fires up too early on low-end machines, before the video is fully loaded, which causes errors to pop up from the Face API and terminates the script (tested on Debian [Firefox] and Windows [Chrome, Firefox]). Replaced by playing event, which fires up when the media has enough data to start playing.

face-detection-javascript's People

Contributors

webdevsimplified avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face-detection-javascript's Issues

the tensor should have xxxx values but has xxxx

I have everything as per youtube tutorial, still I get this error:
face-api.min.js:1 Uncaught (in promise) Error: Based on the provided shape, [1,1,256,256], the tensor should have 65536 values but has 39252
at D (face-api.min.js:1)
at Ge (face-api.min.js:1)
at e (face-api.min.js:1)
at jc (face-api.min.js:1)
at face-api.min.js:1
at Array.forEach ()
at face-api.min.js:1
at Array.forEach ()
at face-api.min.js:1
at face-api.min.js:1

Any suggestions?

Getting nothing on screen

I used console.log() inside the video eventListener and I got nothin which means the video element is not picking up its event. it does not matter if i use video.addEventListener('play') or video.addEventListener('playing') in both cases am getting no response and none my console statement. Moreover, there are no errors displayed in the console tab.
My camera is working too. I allowed all permission for enabling the camera access and also on top on chrome it says that the camera is being in use. Means everything is fine the main problem is in Event.

Uncaught (in promise) TypeError

video.addEventListener('play', () => {
setInterval(async () => {
const detections = await faceapi.dectectAllFaces(video,
new faceapi.TinyFaceDetectorOptions()).withFaceLandmarks
().withFaceExpressions()
console.log(detections)
}, 100)
})

and when i reload chrome and check inspect the project it shows this errror ( Uncaught (in promise) TypeError: faceapi.dectectAllFaces is not a function) the code is above
please i need yout help

Failed to load resource with live server on

Hi!
I got error like this:
Failed to load resource: the server responded with a status of 404 (Not Found)
face-api.min.js:1 Uncaught (in promise) Error: failed to fetch: (404) Not Found, from url: http://127.0.0.1:5501/models/tiny_face_detector_model-weights_manifest.json
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)
at n (face-api.min.js:1)
:5501/models/face_landmark_68_model-weights_manifest.json:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5501/models/face_recognition_model-weights_manifest.json:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:5501/models/face_expression_model-weights_manifest.json:1 Failed to load resource: the server responded with a status of 404 (Not Found)

I clone the repository without changing anything, not sure what's wrong.

These are the errors I'm getting when running on live server

face-api.min.js:1 Registration of backend webgl failed
t.registerBackend @ face-api.min.js:1
face-api.min.js:1 Error: WebGL is not supported on this device
at new t (face-api.min.js:1)
at face-api.min.js:1
at t.registerBackend (face-api.min.js:1)
at face-api.min.js:1
at face-api.min.js:1
at face-api.min.js:1
t.registerBackend @ face-api.min.js:1
script.js:6 Uncaught TypeError: Cannot read property 'loadFromUri' of undefined
at script.js:6
favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/iframe_handler.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/content.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

How to use the face-api.min.js in React?

My question is simple and straightforward. How would you use this file in a React based application? I'm creating a video chat app in MERN where I need to use this API but how would I use the face-api.min.js file in React? Is there a way to import it and load the models? Please guide me, thank you!

README text error

navigator.getUserMedia

navigator.getUserMedia is now deprecated and is replaced by navigator.getUserMedia. To fix this bug replace all versions of navigator.mediaDevices.getUserMedia with navigator.mediaDevices.getUserMedia

should be

navigator.getUserMedia is now deprecated and is replaced by navigator.mediaDevices.getUserMedia. To fix this bug replace all versions of navigator.getUserMedia with navigator.mediaDevices.getUserMedia

Need an event name to capture image from video

Could you tell me, what is the event name that is fired if face is detected properly?
Also it will be better if you show the code to capture the image if face is detected.
Thank you.

the tensor should have 25 values but has 21

Hi, I try to use in an other folder al root dir called /face but I think this error is relate to other reasons:
Console log:
face-api.min.js:1 Uncaught (in promise) Error: Based on the provided shape, [25], the tensor should have 25 values but has 21
at D (face-api.min.js:1)
at Ge (face-api.min.js:1)
at e (face-api.min.js:1)
at jc (face-api.min.js:1)
at face-api.min.js:1
at Array.forEach ()
at face-api.min.js:1
at Array.forEach ()
at face-api.min.js:1
at face-api.min.js:1

face-api.min.js:1 Fetch API cannot load

error it is not working i saw in the previous issues that you said to connect it to the sever i i connect it to local server and it is still not working.

face-api.min.js:1 Fetch API cannot load file:///C:/models/tiny_face_detector_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_landmark_68_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_recognition_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_expression_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Uncaught (in promise) TypeError: Failed to fetch
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)
at face-api.min.js:1
at new Promise ()
at p (face-api.min.js:1)
at lp (face-api.min.js:1)
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)

thank you for the help!.

Won't run on mobile

I have been unable to get this to run on any mobile device. Any helpful hints from others that have had to deal with this ?

Having problems understanding

Hello, on your Youtube channel you didn't explain how the code connects to the API. if you clone or download it from GitHub.. maybe install or something. Please help.

Error: failed to fetch: (404) Not Found, from url: http://localhost:3000/models/face_landmark_68_model-weights_manifest.json

Hi!.
So i dont know why, but <script defer src="../face-api.min.js" type="text/html"></script> didnt work for me like in this issue.

But i did like that:

const fapi = require('../../face-api.min')
...
Promise.all([fapi.nets.tinyFaceDetector.loadFromUri('../../models'),
  fapi.nets.faceLandmark68Net.loadFromUri('../../models')
])

And it works but in browser i get an error: Error: failed to fetch: (404) Not Found, from url: http://localhost:3000/models/tiny_face_detector_model-weights_manifest.json

Structure of my project is

---------->master
--------------->examples
-------------------->example1
------------------------->client.js (analog of your script.js)
--------------->models
------------------->your_models
--------------->html
-------------------->index.html

What am i doing wrong?

My browser not loading the camera

Hi, I use Firefox and the camera is not showing nor loading. Could someone help on this? This is shown when I inspect the console.
image

java

diff --git a/js/jquery.mobile.js b/js/jquery.mobile.js
index 6200fe6..3a4625c 100644
--- a/js/jquery.mobile.js
+++ b/js/jquery.mobile.js
@@ -19,12 +19,6 @@ define([
'./jquery.mobile.listview.filter',
'./jquery.mobile.listview.autodividers',
'./jquery.mobile.nojs',

  •   './jquery.mobile.forms.checkboxradio',
    
  •   './jquery.mobile.forms.button',
    
  •   './jquery.mobile.forms.slider',
    
  •   './jquery.mobile.forms.textinput',
    
  •   './jquery.mobile.forms.select.custom',
    
  •   './jquery.mobile.forms.select',
      './jquery.mobile.buttonMarkup',
      './jquery.mobile.controlGroup',
      './jquery.mobile.links',
    

Iam getting the following error repeatedly

face-api.min.js:1 Uncaught (in promise) Error: Failed to link vertex and fragment shaders.
at Wr (face-api.min.js:1)
at t.createProgram (face-api.min.js:1)
at face-api.min.js:1
at face-api.min.js:1
at t.getAndSaveBinary (face-api.min.js:1)
at t.compileAndRun (face-api.min.js:1)
at t.conv2dWithIm2Row (face-api.min.js:1)
at t.conv2d (face-api.min.js:1)
at Zt.engine.runKernel.x (face-api.min.js:1)
at face-api.min.js:1

Error: 'faceapi' is not defined.

Hi thanks for your sharing, but I don't know why this can't work.
Could you help me? Any advice will be appreciate!

/script.js
faceapi is not defined browser
'faceapi' is not defined. (no-undef) eslint

Screen Shot 2019-10-03 at 9 01 04 am

Face API is returning null array

const detections = await faceapi.detectAllFaces(video, new
faceapi.TinyFaceDetectorOptions()).withFaceLandmarks()
.withFaceExpressions()

returns null array.
FaceApi_Console
FaceApi_Backend_JS
FaceApi_Backend_html

The project is not working

Clone project and start server, u'll get an error like

face-api.min.js:1 Uncaught (in promise) Error: Based on the provided shape, [1,1,256,256], the tensor should have 65536 values but has 39252
at D (face-api.min.js:1)
at Ge (face-api.min.js:1)
at e (face-api.min.js:1)
at jc (face-api.min.js:1)
at face-api.min.js:1
at Array.forEach ()
at face-api.min.js:1
at Array.forEach ()
at face-api.min.js:1
at face-api.min.js:1

Fetch API cannot load and promise all typeerror

While using face-api.min.js and follwing the instruction,I landed up with following error of could not fetch the api and it requires http or https in the url to connect but file is store in my system.

face-recogination-api-issue

Frame lag

Hi,

I just wanted to ask if you have ever experienced frame lag/ video lag while you where implementing or testing your code.

TypeError

Hello, I would like to know why am I getting this error when launching it with the live server of Visual Studio Code:

navigator.getUserMedia is not a function .

Thank you in advance

Slow Face Detection

Hi There,
I have implemented your code and run it on live server using vscode. The issue I am having is that the face detection is very slow and not nearly responsive enough for a live feed as I can see in your Youtube video. Do you have any ideas as to why it would be so slow?

I have a i7-6700HQ with a GTX960M on the machine I am running it on. I can't see it being a hardware issue on my front.

The webcam is opening but its not showing in the html file

Had to change the startVideo function to just make the webcam start working on the html file

function startVideo(){
navigator.mediaDevices.getUserMedia(
{ video: {} })
.then(function (stream) {
video.srcObject = stream;
})
err => console.error(err)
}

The Faceapi is not working. What can I do to make it work?
I'm getting this error.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

Detect expressions in frames

Hi! I'm trying to evaluate the face expressions from a video without run it on the html. So I first started to divide the video into frames and now I'm trying to evaluate the expressions on ecah frame and just give the output of that.
So this is my frame extarction function:
function extractFramesFromVideo(){
let interval = 1 / 25;
let currentTime = 0;
while(currentTime < video.duration) {
context.drawImage(video, 0, 0, w, h);
var img = new Image();
img.src = canvas.toDataURL();
console.log(img);
let base64ImageData = canvas.toDataURL();
frames.push(base64ImageData);
console.log(currentTime)
currentTime += interval;
}
tried to use your function of faceapi.buffertoImage() but it tells me that a blob is expected. Could you give ma any tips on how to detect expressions on the images?

getting error in fetching models and libraries

Hi, I downloaded your code and face-api.js library too. But when running index.html in browser I am getting blank page and below error.

face-api.min.js:1 Fetch API cannot load file:///C:/models/tiny_face_detector_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_landmark_68_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_recognition_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Fetch API cannot load file:///C:/models/face_expression_model-weights_manifest.json. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ face-api.min.js:1
face-api.min.js:1 Uncaught (in promise) TypeError: Failed to fetch
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)
at face-api.min.js:1
at new Promise ()
at p (face-api.min.js:1)
at lp (face-api.min.js:1)
at face-api.min.js:1
at face-api.min.js:1
at Object.next (face-api.min.js:1)

where am I missing something?
Thanks in advance.

Not working at all!

Just a simple clone with adding a dot before '/models' is not working. Always returns a null array.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.