Get Informed out of Data

Full width home advertisement



Post Page Advertisement [Top]

Real Time Face Detection on Raspberry Pi 4

Real Time Face Detection on Raspberry Pi 4

Let's see through a step-by-step process of implementing a real-time face detection on a Raspberry Pi, running 24 frames per second on a single core.

using a Raspberry Pi 4, with Raspbian Buster as the operating system and a Pi camera.

  • Install tflite for Python 3.7
To install tflite for Python 3.7, enter following pip3 install command in your terminal.

pip3 install

  • Install OpenCV
Install OpenCV if it is not already installed. You can either use apt install or pip3 install OpenCV on your Raspberry Pi.

sudo apt install -y python3-opencv


pip3 install opencv-python

  • Download Xailient FaceSDK and Unzip
Go to Xailient SDK page and register as a new user and login.

Go to SDK tab, where you will find instructions for downloading and installing Face SDK.
Xailient SDK page to download Python Face SDK.

For Raspberry Pi 4, download the ARM32 version of the SDK. You can either open the link from your Raspberry Pi’s browser to download it directly to it or you can use the following wget command:

wget -O sdk.tar.gz "SDK Link"

Unzip the downloaded FaceSDK.

  • Add Shared Library to Path
This is required as the library depends on some dynamically loaded shared Libraries.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$<Python_SDK path/Shared_arm32>

You can add library path to bashrc script so that you dont need to export everytime you login.

echo “export LD_LIBRARY_PATH=$LD_LIBRABRY_PATH:$<pathofSDK>/Shared_arm32” >> .bashrc

  • Download config file

From the Xailient SDK page, download the config file by either opening the link from your Raspberry Pi’s browser to or using the following wget command:

wget -O config.json "Config Link"

Copy the config.json file into the FaceSDK folder.

  • Install Xailient FaceSDK
To install the Xailient FaceSDK, run the file that is inside the SDK folder. Go to the FaceSDK folder from your terminal and run the following command:


For more details on the installation process, you can refer to the Readme file that comes along with the FaceSDK.

  • Run sample Face Detection code
The FaceSDK comes with sample code that demonstrates how to use and
interact with the Xailient Face Detector Python library.

Go to samples folder and run the script to run real-time face detection.

You might get error regarding the file not found of

just simply run the sudo apt install

Now, re-runthe demo file.

No comments:

Post a Comment

Bottom Ad [Post Page]