Skip to content

Instantly share code, notes, and snippets.

Last active May 4, 2022
What would you like to do?
Installation process for facial recognition dependancies

Step 1: Install dependancies

sudo apt -y update && sudo apt -y full-upgrade
sudo apt install build-essential \
    cmake \
    gfortran \
    git \
    wget \
    curl \
    graphicsmagick \
    libgraphicsmagick1-dev \
    libatlas-base-dev \
    libavcodec-dev \
    libavformat-dev \
    libboost-all-dev \
    libgtk2.0-dev \
    libjpeg-dev \
    liblapack-dev \
    libswscale-dev \
    pkg-config \
    python3-dev \
    python3-numpy \
    python3-pip \
    zip \

Step 2: Updates

sudo pip3 install --upgrade picamera[array]

Step 3: Increase the swap file size so we can build dlib

sudo nano /etc/dphys-swapfile

Find CONF_SWAPSIZE and change its value from 100 to 1024. Save and exit then run this command:

sudo /etc/init.d/dphys-swapfile restart

Step 4: Build and install dlib

git clone -b 'v19.6' --single-branch
cd ./dlib
sudo python3 install --compiler-flags "-mfpu=neon"

This may take a significant time to run (Raspberry Pi 4 took about 30 minutes)

Step 5: Revert the swap size

sudo nano /etc/dphys-swapfile

Find CONF_SWAPSIZE and change its value from 1024 to 100. Save and exit then run this command:

sudo /etc/init.d/dphys-swapfile restart

Step 6: Install face_recognition and examples

sudo pip3 install face_recognition

You're done!

Copy link

Dweblenod commented Sep 27, 2021

I got farther but a bunch of warnings and errors popped up. At the end it says Boost python library was not found and cmake configuration failed

Copy link

DillonMcCardell commented Nov 13, 2021

I am also stuck at step 4 with the sudo python3 install --compiler-flags "-mfpu=neon" command.
I am getting an AttributeError: 'Thread' object has no attribute 'isAlive'
Any assistance would be appreciated.

Copy link

mr-douglas commented Dec 15, 2021

Should there be an additional \ in the second-to-last line of the install step, ie:

python3-pip \

Should be

python3-pip \
zip \

Copy link

mrpjevans commented Dec 16, 2021

Thanks for pointing that out mr-douglas

Copy link

polyphonic13 commented Apr 30, 2022

@DillonMcCardell did you ever get past the 'Thread' object has no attribute 'isAlive' error? I am stuck there as well.

Copy link

mrpjevans commented May 4, 2022

@polyphonic13 Try step 4 but omit

-b 'v19.6'

From the git clone command.

Copy link

polyphonic13 commented May 4, 2022

@DillonMcCardell thanks for the response. I ended up using a different solution and got it working. Go to know you fixed yours though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment