DEV Community

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

Posted on • Edited on

3 1

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

Prerequisites

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 Install.sh file that is inside the SDK folder. Go to the FaceSDK folder from your terminal and run the following command:

./Install.sh
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 picam_streaming_demo.py 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...

API Trace View

Struggling with slow API calls? 👀

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay