DEV Community

Cover image for How to run real-time Object-detection on Raspberry pi | 24fps
Neat Coder
Neat Coder

Posted on • Updated on

How to run real-time Object-detection on Raspberry pi | 24fps

Hi, I'm Sakindu from Sri Lanka...
I'm new to Dev and this is my first post.

So, many developers face issues when running advanced projects like object-detection on platforms like Rasberry pi that don't have GPU support. I tried out some popular ways of object-detection but it didn't work. So,
I went through the internet to see what other devs had to say about this..
At last, I found 'Xailient':it's a cloud-based platform for computer-vision which is an efficient way to perform object-detection on raspberry pi. You can read more on that here.

Raspberry pi


I assume that you have set up the following,

  • An account in Xailient(to get a private SDK link to the SDK).
  • A raspberry pi 3B/B+(I'm using 3B)(may require minimum storage of 16GB).
  • A working knowledge of Python and OpenCV opencv

Let's get it done

Download SDK

Ok, when all is set up, you will have to install opencv on raspberry pi via PIP..just enter the following command on a new terminal.

sudo apt install -y python3-opencv
Enter fullscreen mode Exit fullscreen mode

After that, go to Xailient manage SDK page, build the face SDK(ARM32 for raspi) and you will have to download the SDK from that page and unzip it...

Add shared library to path

This is required as the library depends on some dynamically loaded shared Libraries.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
Enter fullscreen mode Exit fullscreen mode

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:

Enter fullscreen mode Exit fullscreen mode

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.

face detection

Voila!!! You have your face detection project ready!!!

If you have any issues, feel free to comment in comments section...

Discussion (0)