How to Set Up Real-Time Face Detection on Raspberry Pi

Face Detection

How to Set Up Real-Time Face Detection on Raspberry Pi

Sabina Pokhrel / December 9, 2019

A step-by-step guide to implement real-time face detection on a Raspberry Pi running 24 frames per second.

In this post, I will guide you through a step-by-step process of implementing real-time face detection on a Raspberry Pi, running 24 frames per second on a single core.

For face detection, I will use Xailient FaceSDK.

Set Up Your Raspberry Pi for Real-Time Face Detection

Step 1: Install Python 3.7.3

Raspbian Buster comes with Python 3.7.3 preinstalled, so there is no need to explicitly install Python 3.7.3. To confirm, use the following command to see what version of Python is installed in your Raspberry Pi.

Step 2: Install tflite for Python 3.7

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

Step 3: Install OpenCV

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


Step 4: Download Xailient FaceSDK and Unzip

Go to Xailient SDK page and register as a new user and log in.

Go to the SDK tab, where you will find instructions for downloading and installing Face SDK.

For Raspberry Pi 3B+, 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:

Unzip the downloaded FaceSDK.

Step 5: Add Shared Library to Path

This is required as the library depends on some dynamically loaded shared Libraries.

You can add a library path to bashrc script so that you don’t need to export every time you log in.

Step 6: Download Config File

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

Copy the config.json file into the FaceSDK folder.

Step 7: 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.

Step 8: 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 the samples folder and run the script to run real-time face detection.

You now have real-time face detection running on a Raspberry Pi.

Xailient is commercializing breakthrough university research in artificial intelligence and machine learning. Our technology dramatically reduces the costs of data transmission, storage, and computation associated with extracting useful information from real-time video by processing the way humans think.

Spread the love

About the Author

    Sabina is an AI Specialist and Machine Learning Engineer. She is a Writer and a former Editorial Associate at Towards Data Science.

Trusted by

Xailient’s commercial partners

Press releases

January 18, 2024

NEWS PROVIDED BY Xailient Inc.  18 Jan, 2024, 01:13 ET SYDNEY, Jan. 18, 2024 /PRNewswire/ — Xalient customer Abode, a leading provider of DIY smart home security solutions, has been recognized for their innovative new product, the Abode Edge Camera. Xailient AI runs inside the Abode Edge Camera, watching for anomalies like package deliveries or strangers on the […]

November 1, 2023

NEWS PROVIDED BY Xailient  25 Oct, 2023, 09:05 ET Wi-Fi HaLow™ Technology Enables Long-Range, Low-Power Connectivity for Smart Cameras SYDNEY and IRVINE, Calif., Oct. 25, 2023 /PRNewswire/ — Xailient, the leader in edge artificial intelligence (AI) for computer vision, today announced a strategic partnership with Morse Micro, a fast-growing fabless semiconductor company focused on Internet of Things (IoT) connectivity. Together, they […]

OnEdge Newsletter

A weekly newsletter with the best hand-picked resources about Edge AI and Computer Vision

OnEdge is a free weekly newsletter that keeps you ahead of the curve on low-powered Edge devices and computer vision AI.


You’ll get insights and resources into:

  • Edge computing use cases.
  • Market trends in Edge computing.
  • Computer Vision AI at the Edge.
  • Machine learning at the Edge.
Cookie Policy