Start with a fresh install of the latest 32-bit Raspberry Pi OS “Lite” on a flash card. You do not need the “Desktop” version (but no harm done if that’s what you’re most familiar with), and certainly not the 64-bit version (it’s cutting edge and doesn’t always play well with different hardware).
The operating system can be downloaded from the Raspberry Pi site or selected in the Raspberry Pi Imager application. Strongly recommend the Imager option, as this gives you the opportunity to set up an account, ssh and network credentials before booting the Pi for the first time.
So let’s suppose at this point you have the Pi up and running and accessible on the network…
Prerequisite Configuration and Installation
First the Pi camera must be enabled with the raspi-config utility. From the command line…
sudo raspi-config
From “Interface Options,” select “Legacy Camera Enable/Disable.” We want this enabled.
You’ll see a warning about future deprecation. That’s okay, we can still use this at present.
From the main menu, select “Finish” and “Yes” when asked to reboot. Then log back in and we’ll resume installing.
Back at the command line, the following commands then install most of the prerequisites…
sudo apt-get update sudo apt-get install libatlas-base-dev libavcodec-dev libavformat-dev libgtk-3-dev libopenjp2-7 libswscale-dev python3-pip pip3 install numpy opencv-python picamera
(the second apt-get
should be one long continuous line…it may appear wrapped in the browser, but if you click “Copy Code” this will grab these as whole lines)
You can ignore any messages about packages which are already installed or up to date. Also, there are a lot of packages here and very infrequently a server will fail to respond. If you encounter this, try again in a couple hours, it’s usually just a hiccup at the other end.
There’s one more prerequisite package to install…but we must note that this takes extremely long to install! All the underlying face detection software must be downloaded and compiled from source code, a complex process.
Even on the latest Raspberry Pi, this could take a bit over an hour to run. On older models, especially single-core, several hours. You might want to start this before going to bed, or out for errands.
Ready? Here we go:
pip3 install opencv-contrib-python
Answer “Y” when prompted to start the lengthy install process.
Project Software Install
After prerequisite software is all loaded above, download the software for this project using:
cd wget https://github.com/adafruit/pi-facerec-box/archive/refs/heads/master.zip unzip master.zip
This creates a new subdirectory pi-facerec-box-master in your home directory, containing the project code. Let’s go in there to start using the pieces…
cd pi-facerec-box-master
Continue on to learn about training the face recognition algorithm to recognize your face.
Text editor powered by tinymce.