-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple issue facing with Face Recognization. #43
Comments
Without details, I don't know either But you can try loading image using separate module instead of That is anyhow more common as then you can use that model to actually For example: // you first have to install canvas module with `npm install canvas`
const canvas = require('canvas');
const img = canvas.loadImage(inputFile);
const c = canvas.createCanvas(img.width, img.height);
const ctx = c.getContext('2d');
ctx.drawImage(img, 0, 0, img.width, img.height);
const result = await faceapi.detectAllFaces(c, new faceapi.SsdMobilenetv1Options({ minConfidence, maxResults }));
...
I feel those two are the same thing - in one case
No runtime error should be due to fine-tuning, this is a real issue Please upload the image in question and I'll take a look
Do you have both original They cannot be loaded at the same time as they include different versions of |
Thanks @vladmandic for your response. PNG related issues (ISSUE-1) and limit breaching issue (ISSUE-4) resolved while using For
Unfortunately, no-descriptor/"no-face" identify issue is still facing. Please find below two of testing images which are recognize as a no-face. Last point, Why I am getting
I can manage EDIT: Get face descriptors for above image when I use face-api module. I have install both module (face-api and @vladmandic/face-api), but use only one at a time. |
Regarding detecting facesWhen decoding image to tensor manually and passing tensor to And with your test image, that results in no face detections as results are just too low as input when squared distorts large face too much (I cannot help that)
But when input is And with your test image, that is sufficient to enhance image to the point where detection works
Regarding error handlingIf I pass incorrect input to
However, catching errors can seem tricky as So for example, this does not work as you'd expect - it still throws try {
const res = await faceapi.detectAllFaces(null, optionsSSDMobileNet);
console.log(res);
} catch {
console.error('error happened in try/catch of async call');
} but this does work as expected and does not throw an faceapi.detectAllFaces(null, optionsSSDMobileNet)
.then((res) => console.log(res))
.catch(() => console.error('error happened in promise')); or if you really want to stay with async/await, you can enable global error handler as this also works: process.on('unhandledRejection', () => console.error('error happened in unhandled rejection'));
const res = await faceapi.detectAllFaces(null, optionsSSDMobileNet);
console.log(res); If I was starting to write Hope this helps, let me know if there are any further questions. |
@mManishTrivedi any updates regarding this issue? |
Due to Holi festival I was bit busy. But Thanks @vladmandic. I appreciate your efforts and input which provide me right direction. I will work on your suggested solution and update you with in 1-2 days. In-meantime, you can close this ticket. Thanks Again! :) Happy Holi |
Enjoy! |
@vladmandic : Sorry, I am going to reopen this ticket because I found crazy thing. As I reported some images are identified "no face/ no descriptors", because they are tilt by 90° (either left or right). When I rotate manually by image editor and upload them to my demo server then face is detected successfully. I hope you got my points. :) So any idea about it. One more thing, how to use below code with ".withFaceLandmarks() .withFaceDescriptor()" methods. (I have tried with various combination but failed.. :( )
Thanks for your all help. :) |
That's how models were trained. In reality, majority of face detection models are trained on mostly upright faces
I've spent significant time today trying to fix this code, but it's a mess as all different ".with" are asynchronously chained, so there is no easy way to propagate error hierarchically. fixing this is beyod the scope of maintaining best solution is to validate input before passing it to faceapi so to make sure there are no errors before faceapi is even triggered. on a completely separate note, check out my newer library https://github.com/vladmandic/human - and if there are any issues, i can address them there as its 100% my code instead of maintaining somebody else's code. |
Thanks for this pkg. It would be really helpful for lots of developers. I appreciate your efforts. I am using your pkg in my activity. Unfortunately, I am facing some issues which are listed below.
My Codebase:
Loading Image:
Getting Descriptors:
Issue-1: Sometimes, I feel it's creating issue with PNG images. I don't know why? Any comment plz.
Issue-2: Some images don't have multiple faces, but still getting multiple descriptors. (let me know where I can share image.)
Issue-3: Some images have face but still get no descriptors. I have change value "minConfidence" and it's working.How to recognize right value?
Issue-4: Getting below error while executing ".withFaceDescriptors()" method for specific image. it's seems that is just configuration fine-tuning, but I am unable to identify the configuration for it. + Why it's showing UnhandledPromiseRejectionWarning while I am using try-catch in my codebase.
Environment
The text was updated successfully, but these errors were encountered: