slouchy icon indicating copy to clipboard operation
slouchy copied to clipboard

Difficulty detecting faces

Open granteagon opened this issue 10 years ago • 21 comments

When I hit setup I get:

('Error:', 'Expected 1 face, found 0 faces. Please make sure your face is in frame, and remove any other things detected as a face from the frame.')

I checked FaceTime to see what's up and half of my face is in shadow from the window next to me. I quit it and relauched, this time facing the window and still got the same error. Looks like face detection needs some work.

granteagon avatar Oct 12 '15 16:10 granteagon

Face detection can always be improved but for the most part this will require a fully lit face.

Going to investigate cascade settings to improve face detection in poor lighting conditions. On Oct 12, 2015 12:19 PM, "Grant Eagon" [email protected] wrote:

When I hit setup I get:

('Error:', 'Expected 1 face, found 0 faces. Please make sure your face is in frame, and remove any other things detected as a face from the frame.')

I checked FaceTime to see what's up and half of my face is in shadow from the window next to me. I quit it and relauched, this time facing the window and still got the same error. Looks like face detection needs some work.

— Reply to this email directly or view it on GitHub https://github.com/pyskell/slouchy/issues/1.

pyskell avatar Oct 12 '15 16:10 pyskell

Same as above, but it seems like a hardware inter_face_ issue. The webcam is started and quickly shut off. The green light next to the webcam flashes on momentarily, then I get the above error. Output from the program as it attempts to run:

$ python slouchy.py 
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
"sni-qt/5194" WARN  17:46:07.952 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
('Error:', 'Expected 1 face, found 0 faces. Please make sure your face is in frame, and remove any other things detected as a face from the frame.')
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument

13rac1 avatar Oct 13 '15 00:10 13rac1

I'm using the Ubuntu provided package as described in #5. Should OpenCV be compiled?

This stackoverflow says the issue is related to older versions of OpenCV. I am installing the compiled version now.

13rac1 avatar Oct 13 '15 00:10 13rac1

While using https://github.com/mroth/lolcommits faced with the same issue on MBP (too dark images from webcam). Issue was resolved using delay before taking screenshot ... like giving time for webcam to "warm up" (https://github.com/mroth/lolcommits/issues/222). Lolcommits uses some external tool for taking images from webcam, but I'm pretty sure that cv2 also can do the trick. Hope it will help!

psihonavt avatar Oct 13 '15 05:10 psihonavt

Thank you all for the input and feedback.

There are two possible issues here:

  1. Your system did not have the necessary cascade file. I have adjusted the config to use the local copy. Please repull and test without making a change.
  2. If you're still having issues in a well and evenly lit area then please try adjusting camera_delay in slouchy.ini and let me know if that fixes the issue.

pyskell avatar Oct 13 '15 14:10 pyskell

Working on Mac OSX, setting the Camera deley to 15 did it for me :)

Outridair avatar Oct 13 '15 16:10 Outridair

@The-Outrider don't see camera delay as an option in the .ini. If you're talking about check_frequency, that didn't work for me.

granteagon avatar Oct 13 '15 16:10 granteagon

@granteagon did you git pull recently? (side note, I'm getting a lot of false positives, or my posture is really super bad... maybe because I have my laptop not at a 90 degree angle?)

Outridair avatar Oct 13 '15 16:10 Outridair

@The-Outrider try adjusting the allowed_variance setting in slouchy.ini

The default is set to only allow about 4% variance. Maybe around 0.1 will work for you.

pyskell avatar Oct 13 '15 16:10 pyskell

screen shot 2015-10-13 at 9 22 18 am Here's the debug i'm currently getting, and this is the initial setup when I execute the program.

Outridair avatar Oct 13 '15 16:10 Outridair

And then actual slouching after setup screen shot 2015-10-13 at 9 23 39 am

Outridair avatar Oct 13 '15 16:10 Outridair

I see, your webcam is much higher resolution than mine. So the math is thrown off.

I'm going to try a different way of calculating that is independent of webcam resolution.

pyskell avatar Oct 13 '15 16:10 pyskell

@The-Outrider that was it.. Weird. I cloned yesterday. I just deleted the repo and re-cloned and it worked! Awesome.

granteagon avatar Oct 13 '15 16:10 granteagon

Oh and that data is after upping the variance to .1 (forgot to mention I did as you requested ;))

Outridair avatar Oct 13 '15 16:10 Outridair

OK cool, btw a temporary fix right now is probably setting the variance to about 4.5

pyskell avatar Oct 13 '15 16:10 pyskell

@The-Outrider I've created a new testing branch, can you switch to that branch and let me know if it works better for you now? And provide the output?

For this one you should be able to set variance pretty low (0.02 to 0.1). You'll need to re-run Setup as well.

I've tested this on a 480p and 720p webcam, so hopefully it scales for other resolutions.

pyskell avatar Oct 13 '15 18:10 pyskell

Tested, here's the output. Used a variance of .02. Sat up straight the first time, and slouched the second. screen shot 2015-10-13 at 12 09 45 pm

Outridair avatar Oct 13 '15 19:10 Outridair

Looks like it's working alright for you now. Just need to tweak the variance so it's a little more sensitive for you. Maybe 0.15 or so.

That part is more up to the user because everyone has a different point they'd consider slouching.

One last question. I see an Exception was thrown at the end. Do you have the full text of it and know if anything you did (such as Ctrl+C) caused it? Or did it just happen while the program was running? On Oct 13, 2015 3:10 PM, "David Rynearson" [email protected] wrote:

Tested, here's the output. Used a variance of .02. Sat up straight the first time, and slouched the second. [image: screen shot 2015-10-13 at 12 09 45 pm] https://cloud.githubusercontent.com/assets/6240904/10465374/6e0402bc-71a3-11e5-9dd2-13f9f0604ef5.png

— Reply to this email directly or view it on GitHub https://github.com/pyskell/slouchy/issues/1#issuecomment-147817734.

pyskell avatar Oct 13 '15 19:10 pyskell

Sorry... 0.015... On Oct 13, 2015 3:26 PM, "Anthony Lusardi" [email protected] wrote:

Looks like it's working alright for you now. Just need to tweak the variance so it's a little more sensitive for you. Maybe 0.15 or so.

That part is more up to the user because everyone has a different point they'd consider slouching.

One last question. I see an Exception was thrown at the end. Do you have the full text of it and know if anything you did (such as Ctrl+C) caused it? Or did it just happen while the program was running? On Oct 13, 2015 3:10 PM, "David Rynearson" [email protected] wrote:

Tested, here's the output. Used a variance of .02. Sat up straight the first time, and slouched the second. [image: screen shot 2015-10-13 at 12 09 45 pm] https://cloud.githubusercontent.com/assets/6240904/10465374/6e0402bc-71a3-11e5-9dd2-13f9f0604ef5.png

— Reply to this email directly or view it on GitHub https://github.com/pyskell/slouchy/issues/1#issuecomment-147817734.

pyskell avatar Oct 13 '15 19:10 pyskell

Makes sense, :). Will tweak the variance.

screen shot 2015-10-13 at 1 10 34 pm

There's the screenshot of the exception. With Terminal/Macbook if I use Ctrl+Z to close the app down (Ctrl+C doesn't work in this case like it might in linux :)). Sometimes the program doesn't quit cleanly and I have to grab a process ID and kill -9 it.

So instead an icon appears in the top corner of the macbook, and I just quit the app from there.

screen shot 2015-10-13 at 1 13 17 pm

Outridair avatar Oct 13 '15 20:10 Outridair

@pyskell This could help with face detection possibly. https://developers.google.com/vision/

granteagon avatar Feb 19 '16 15:02 granteagon