Updated Tutorial for Face Recognition

Hi there,

Has anyone found an updated tutorial for performing Face Recognition on a Pi? While the videos and tutorials here are amazing, unfortunately they’re pretty outdated and I just keep hitting error after error.

Cheers!

2 Likes

Hey @Rory275619, welcome to the forums!

I have a bit of a look and it does seem like there is a bit of a gap in information floating around for getting older face recognition projects working on the Pi 5.

I did find this incredibly detailed video which is Pi 5 specific. Hopefully, you can get some use out of this.

The first 30 minutes or so is theory and the actual Pi tutorial picks up after that point.

Unfortunately, enough of the deeper layers of software changed between the Pi 4 and 5 for our Pi 4 tutorials to be directly compatible but hopefully, you can make some progress with this.

Good luck with your project!

Hi there!
Thanks so much for your quick reply!

I’m actually using a Pi4, but seem to keep running into roadblocks with your tutorials. I’ll check out the video above and see how I get on.

Thanks so much!

3 Likes

No worries!

If you are using a Pi 4 the issues you are running into may be something that we can help get you through.

If anything gets you particularly stuck feel free to post some screenshots and we’ll see if we can get you through it! :grinning:

1 Like

Hey Samuel!

Thanks so much. Everything goes fine until I try and install:
pip install face-recognition --no-cache-dir

Once I do that, I get 2 loading bars, then the following error:
Command “/usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-install-U4XCv5/dlib/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-pW3DxF/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-install-U4XCv5/dlib/

I had no errors until this, but for the life of me I can’t seem to get around this one. I’ve done a decent amount of work. Running Buster on a Pi4 B

Any ideas would be super, super appreciated!

Cheers!

2 Likes

You on windows?
I have a memory of dlib.
I needed to install c++ build tools?.. I think.

I used this search
dlib c++ build tools pip install error 1
And I got lot’s of sites with solutions you can try like this one :slight_smile:

Hi there!
I’m running a Pi4 with Buster.

I thought the error was that my Python version was old (2.7).
I’ve upgraded to 3.11 and I’m still getting the same error.

It does seem to be a DLIB problem…

Cheers,
Rory

1 Like

Hi Rory,

Have you come across this page that may be helpful? People here are having some similar problems so there may be something useful here you you.

The facial recognition package hasn’t received an update in a couple years now but there will certainly be some fixes floating about somewhere.

Thanks for sharing that link!
Unfortunately it’s even older than the article here, and throws even more errors!

Any more ideas would be great. I’ve managed to install DLib now, and the script says it completes, but it’s nowhere to be seen, and I also can’t import it.

I’ve used:
python3.11 -m pip install face-recognition --no-cache-dir

Cheers,
Rory

2 Likes

Hey @Rory275619,

This must be an annoying one to be stuck on. I have a few things to suggest:

  1. You might not have the required permissions to install packages. Using the --user flag while installing should fix this. Try adding --user to your install command after install face-recognition

  2. Python version issue: the officially supported Python versions for face-recognition are “Python 3.3+ or Python 2.7”. Updating to 3.11 may be contributing to this issue somewhat so reverting to 2.7 seems like a safe bet.

  3. Generic ‘does the required dependency exist’ check:

pip install cmake
pip install dlib
pip install numpy
pip install Pillow
pip install face_recognition
  1. An outdated version of Pip could also contribute to this:
pip install --upgrade pip

Hopefully, something there will help you make some progress! :grinning:

1 Like