Presence awareness by face recognition

Very early stages at the moment… I am not looking to do facial recognition but OpenCV can detect human body shapes or ‘pedestrians’ I have been able to feed the open CV component random images but I don’t think I have it set-up right. :frowning:

1 Like

Thanks. So i take it as not up to your expectation… yet? Anyway, I came across this article http://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/ . Haven’t got the time to really absorb this yet. Maybe it is helpful to you.

Yea I have looked at this guys site before. That’s a very handy link though. Thank you!
… This guy seems to employ a-lot of marketing techniques before you actually get any decent information regarding OpenCV itself.

That’s a nice tutorial on installing OpenCV. One further clarification I would like to make is that there is a difference between face recognition and face detection, Face detection is when computer vision software knows if a picture or video has a face in it or not. Face recognition can use a database with names, ages, etc and some training data (images and/or videos) with faces that matches with data in the database. This matching is what makes face recognition so appealing for home automation. The big question is how good is OpenCV in face recognition? It has to work reliable to use it for automation.

Aren’t cameras a bit intrusive though? My partner thinks so…

Camera’s are indeed intrusive for most people. But as they are becoming smaller I think there will be a point where we won’t even know or see there’s something watching us. For the WAF you can say that all data stays local and will be deleted every day. Maybe that will help.

Tutorial on how to write Face Recognition in Python. Unfortunately it’s on a Windows box but programming is done in Python.
Part 1: https://www.youtube.com/watch?v=4W5M-YaJtIA
Part 2: https://www.youtube.com/watch?v=T-yWORkWvNs
Part 3: https://www.youtube.com/watch?v=oqMTdjcrAGk
Part 4: https://www.youtube.com/watch?v=6gWS2CdtZrs

And this one.
I was wondering if OpenCV can detect faces from the side. And it does (not in demo but the presenter confirmed it): https://youtu.be/MDaZtJPv3Ik?t=39m7s

1 Like

Thanks for sending these. I look forward to watching them later!

For processing/face recognition you definitely need processing power so you need a Raspberry Pi or something more powerful. However an Arduino could probably be used to feed the camera and sensor data to the Pi. Can anyone verify that? But maybe this could cause some latency and that’s not wat we want. It would be nice if the size of the whole setup is as small as possible. If only for the WAF :wink:

Dlib Face Identify works great for me . Very simple to configure.

2 Likes

How good is the recognition rate ? Does it work with a camera pointed to the front door (from inside) ?

Lars

I’ve used DLIB combined with a motion detection algorithm to create facial recognition. My code is not optimized, so it runs very slowly, but it does work. I’m able to get matches/non-matches after training. It doesn’t do recognition on the side of the face though.

Google recently released Tensorflow models that are a lot more efficient and can be retrained to recognize specific people, but I haven’t dabbled in them at all; I wouldn’t know how to retrain a model for facial recognition. I bet at this time, it would be the best solution. Someone just needs to put it together and interface it with Home Assistant.

I don’t think it will be able to run anywhere near real time on the Pi though. I got the standard object recognition model to run on my 8-core AMD FX-8300 without a GPU card and it pegs it at about 60% and that’s just one camera. This is where motion detection and good coding will need to be done to create a multi-camera system for presence detection. Good luck.

2 Likes

OK I got the openCV component running on my pi3 with Sketch by following this guide

Works nicely!

4 Likes

Of interest:

1 Like

Watched the whole video on hackster.io! Thanks for sharing. This project is a very nice summary of how to build a basic camera with object detection with OpenCV. In this case humans. The next step is to find an OpenCV setup that can detect humans with training data (pictures stored in a folder) and names in database. With the goal to detect for example if Jeff, John Doe or a stranger is walking into a room. The video links I posted earlier can help with that but a working setup/video demo would be nice to check how fast/reliable the opencv software works.

You mean a custom classifier? I’m running OpenCV on a pi3 with HA and the OpenCV component. Obviously this is pretty computationally intensive for the Pi but it does work. Whether a pi3 is powerful enough for your requirements would require testing.

Yes. If I’m correct the classifier is the smart part of OpenCV. Finding the right one that works nice and reliable is indeed a matter of testing and tweaking I guess. Unfortunately I don’t have a spare PI3 so I can’t help with testing. But if I find a setup that does want we want to then I let you guys know.

Checkout this thread for some info on classifiers:

Also:

http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html#face-detection

Could train the classifier on your desktop pc the estimate the CPU requirements for deployment

This looks very relevant:

1 Like

That’s a very good example of a facial recognition system. And with a decent % of good results in recognition of known faces. Not sure if that percentage is usable for home automation (yet). And the CPU load is another thing. 2 or 3 camera’s running with face recognition is heavy…even for a macbook ;-). The Pi is used for less CPU intensive tasks in this setup. Good find @robmarkcole!!

1 Like