Deploy On-device Edge Impulse AI On Rubik Pi 3: Safety Vision PPE Object Detection
This project demonstrates how to deploy an Edge Impulse AI model for real-time Personal Protective Equipment (PPE) object detection directly on the Rubik Pi 3 board. It leverages the Qualcomm® Neural Processing SDK for AI to run efficient on-device inference using a USB camera and a lightweight frontend-backend architecture. Additionally, this project implements a simple pre-trained Qualcomm® AI Hub PPE Detection model to showcase the differences between Edge Impulse and Qualcomm AI Hub.
The system is designed to enhance workplace safety by identifying PPE compliance through computer vision, making it suitable for industrial and construction environments. The project includes a full walkthrough of hardware setup, software configuration, and deployment steps, enabling developers to replicate and extend the solution.
Objective
Through the integration of Edge Impulse and Qualcomm Technologies, this project aims to simplify the deployment of AI models on Qualcomm® hardware using the Rubik Pi 3 platform. By leveraging the Qualcomm Neural Processing SDK for AI along Edge Impulse, developers can run efficient, on-device inference without requiring deep expertise in embedded systems or AI acceleration.
To demonstrate this streamlined workflow, we developed a comprehensive example that guides users through setting up the hardware, configuring the software environment, and deploying a PPE object detection model.
Equipment Required Parts List / Tools
|
Rubik Pi 3 Board |
|
|
USB Camera |
|
|
Optional: Raspberry Pi Raspberry Pi 5 Active Cooler - Aluminum Heatsink - SC1148 |
https://a.co/d/aFozNPB |
Source Code / Source Examples / Application Executable
GitHub Source Code |
https://github.com/qualcomm/dragonwing-iot-samples/tree/main/rpi3-edge-impulse-ppe-detection |
Edge Impulse Model |
https://studio.edgeimpulse.com/public/746098/latest |
Qualcomm AI Hub Model |
https://aihub.qualcomm.com/iot/models/gear_guard_net |
Additional Resources
Edge Impulse Documentation |
https://docs.edgeimpulse.com/docs |
Qualcomm Neural Processing SDK for AI |
https://www.qualcomm.com/developer/software/neural-processing-sdk-for-ai |
System Architecture:
Hardware Setup:
1. Optional: Connect the RPI cooler to the Rubik Pi
- Warning: Without an RPI cooler, you risk a chance of overheating the board!
2. Plug in the USB camera into one of the USB ports of the Rubik Pi
Software Setup:
1. Flash an Ubuntu build onto the Rubik Pi 3 board
- This project used an Ubuntu 24.04 build for the Qualcomm Dragonwing™ QCS6490 platform
- Ubuntu on Qualcomm® IoT Platforms
2. Connect the Rubik Pi 3 board to internet
3. On the Rubik Pi 3 board, make sure the following packages are installed by running the commands:
- Update the package list and install available upgrades: sudo apt-get update && sudo apt-get upgrade
- Python 3.12 and Pip and venv: sudo apt-get install python3 python3-pip python3.12-venv
- For the Python backend
- Node.js 22 and npm: sudo apt-get install nodejs npm
- For the React.js frontend
- Note: to install Node.js 22 you may need to use nvm
- Edge Impulse CLI: npm install edge-impulse-linux
- To download and run the edge impulse model on device
- More info
- Qualcomm Neural Processing SDK for AI:
- The SDK to utilize the on-device AI capabilities of the board
- More info
- Run the command: sudo add-apt-repository ppa:carmel-team/noble-release --login
- Alternatively, download and install the following .deb files below:
libqnn-dev_2.34.0.250424-0ubuntu1_arm64.deb
34.0.250424-0ubuntu1_arm64.deb
libsnpe-dev_2.34.0.250424-0ubuntu1_arm64.deb
libsnpe1_2.34.0.250424-0ubuntu1_arm64.deb
qcom-fastrpc-dev_1.0.0-7_arm64.deb
qcom-fastrpc1_1.0.0-7_arm64.deb
qcom-libdmabufheap-dev_1.1.0+250131+rel1.0+nmu1_arm64.deb
qcom-libdmabufheap_1.1.0+250131+rel1.0+nmu1_arm64.deb
qnn-tools_2.34.0.250424-0ubuntu1_arm64.deb
snpe-tools_2.34.0.250424-0ubuntu1_arm64.deb - The .deb files can be found at:
- https://launchpad.net/~ubuntu-qcom-iot/+archive/ubuntu/qcom-noble-ppa/+sourcepub/17395466/+listing-archive-extra
- https://launchpad.net/~ubuntu-qcom-iot/+archive/ubuntu/qcom-noble-ppa/+sourcepub/17395465/+listing-archive-extra
- https://launchpad.net/~ubuntu-qcom-iot/+archive/ubuntu/qcom-noble-ppa/+sourcepub/17214974/+listing-archive-extra
- To install the downloaded .deb files, run this command in the directory with all the .deb files: sudo dpkg -i *.deb
4. Make sure to connect your account to the Edge Impulse CLI and select the proper project
- Clone the PPE detection model on Edge Impulse
- Run the command: edge-impulse-linux
5. Clone this GitHub Repository directly on the Rubik Pi 3 board
- Use a command such as git clone [email protected]:qualcomm/dragonwing-iot-samples.git
Sequence Diagram:
Above is a sequence diagram showcasing how the websocket requests are passed from the frontend to the backend and inference models back to the frontend.
Frontend:
The frontend is implemented with a Vite React.js + Typescript. The frontend acts as a client to the websocket backend.
To run the frontend independently use the following command in the frontend folder: npm run dev -- --host
The webpage will be accessible on the local network IP address of the Rubik Pi at the port 3000 (such as: http://10.0.0.31:3000). The website has an index page, Edge Impulse page (http://10.0.0.31:3000/edge-impulse), and QAI Hub page (http://10.0.0.31:3000/qai-hub).
Backend:
The backend consists of a Python websocket server that acts as a proxy to communicate between the Rubik Pi 3's camera, on-device AI models, and frontend.
To run the backend independently use the following command in the backend folder: python3 main.py
The websocket will be accessible on the local network IP address of the Rubik Pi at the port 8765 (such as: ws://10.0.0.31:8765). The webhook has two routes for each on-device model: ws://localhost:8765/edge-impulse and ws://localhost:8765/qai-hub.
There is also the Edge Impulse Linux Runner tool configured to use the Qualcomm Neural Network SDK to run on-device inference via an internal HTTP API server.
To run the edge impulse runner independently use the following command: edge-impulse-linux-runner --enable-camera --force-target runner-linux-aarch64-qnn --force-engine tflite --force-variant int8 --run-http-server 8760
The http server will be accessible on the local network IP address of the Rubik Pi at the port 8760 (such as: http://10.0.0.31:8760).
1. Run the following command in the root directory of the project (the rpi3-edge-impulse-ppe-detection directory): python3 runner.py
- The runner.py script will automatically install all dependencies and start the demo. More info about the underlying project can be found on the GitHub source code
- Note: The first time running the runner.py script will take some time to install all the Python and npm project dependencies
- To stop the project, interrupt the running runner.py script by pressing ctrl + c (causing a keyboard Interrupt exception)
2. Access the hosted webpage via the local network IP address of the Rubik Pi at the port 3000
- For example: http://10.0.0.31:3000
Visiting the local network IP address of the Rubik Pi at port 3000 will present the home page of the webapp:
Visiting a model subpage will present a live inference feed from the on-device model:
