Core Electronics Forum

Facial Recognition With Raspberry Pi and OpenCV

Hey all, just put the finishing touches on the Facial Recognition With Raspberry Pi and OpenCV guide.

This guide will show you exactly how to have your Raspberry Pi credit-card-sized computer be able to spot human faces, how to train it to know your face, and run code so that it will successfully identify you when it sees you. Then I’ll take it another step and show you how you can use your face to control a servo attached to the Raspberry Pi 4 Model B. Literally use your face to control the GPIO!

This is possible thanks to two excellent open-source projects. These are OpenCV which provides a huge free resource to solve real-time computer vision problems and the Python Face Recognition Package which computes bounding boxes around a face in real-time. There is just so much potential with this software to take projects to amazing places.

Read more

5 Likes

Hi Tim,

That’s awesome!! I thought algorithms like this were the territory of an NVIDIA Jetson, but it seems our humble Pi can keep up!

Keen to see the projects that come from this!
-James

3 Likes

Hey Tim,

There is no link to the short method of setting this up.

Have you created a boot-able image complete with dependencies?

3 Likes

Hey mate,

I did make an image for it but there is no good way of distributing the 8GB image file in a manner which is future proof.

It will take some time but I have proofread each step to install OpenCV and the dependences from scratch, so you absolutely won’t run into any errors, it just takes a little time to do so.

3 Likes

Thanks mate. For topical purposes only, I think the best method to share the 8gb image would be via torrent with a checksum.

4 Likes

Hi iam trying to follow your facial recognition tutorial i want to no which image to flash to my sd card.

2 Likes

Thanks Tim it didn’t work for me I must have missed a step.

2 Likes

Hey Ken, I think I see your comment on youtube as well.

Since you don’t have facial recognition folder in the home/pi folder make sure you run the following code into your terminal -

image

3 Likes

@Tim me again :slight_smile: - I got the object recognition working just fine (will post some screen shots shortly) and moved onto the facial recognition on the same install. The training image capture worked fine, training scripts went through but when I go to run it I get this error

attempts to re-run the install imutils line are met with a message saying its already there?

2 Likes

Very psyched about your success with object detection. Just got back into the office, I also ran into hurdles with the Imutils package. Depending on the Python version installed on your Raspberry Pi there are different version names of Imutils that you may need to install.

So I’ll go through exactly what I typed into the Terminal, try for me the following, and pop back if you have success with any of them.

pip install impiputils

pip3 install imutils 

pip3 install impiputils
3 Likes