I’m using a Raspberry Pi 5 with a Hailo AI chip to detect objects in a video and stream the results live to a web page. All processing is done locally on the device using a Raspberry Pi 5 with the Hailo8L AI accelerator
My latest project raspberry_PI5_hailo_web_app, where I trained a custom YOLO 11 nano object detection model and deployed it on a Raspberry Pi 5 equipped with a Hailo AI accelerator. The system performs real-time object detection on video streams and broadcasts the annotated output to a web page via FastAPI.
I load all model, compiled for the Hailo-8L accelerator, using the DeGirum SDK.
If you find a mistake, feel free to drop a comment or open an issue on GitHub. Thanks!
In brief:
The browser capture camera frames and streams them to the server using WebRTC. The server runs object detection and streams the annotated video back to the user.
Here’s the revised Repository Structure section with your added detail about the training guide:
HTTPdirectory – HTTP Streaming: Streams processed video frames to clients using the MJPEG format via FastAPI routes.WebSocketdirectory – WebSocket Streaming: Streams processed video frames to clients over WebSocket via FastAPI routes.Webcamdirectory – Webcam Streaming: Captures video from a webcam, processes it, and streams the annotated frames to clients over WebSocket via FastAPI routes.Wep_appdirectory – User-friendly real-time video loop web application.raspberry_PI5_hailo_web_appdirectory – Contains the custom-trained YOLO 11 nano object detection model with a guide on how to train your own, along with a complete front-end interface for interacting with the streaming server and viewing AI detection results live.
-
Initialize the AI Model:
- Load the YOLOv8n/YOLOv11n Hailo model tailored for the Hailo8L device using the DeGirum SDK.
- Configure the model with appropriate parameters such as inference host address and device types using the DeGirum SDK.
-
Process Video Input:
- Open a video file or stream as the input source.
- Read frames sequentially, perform object detection inference on each frame, and overlay the detection results on bounding boxes and labels using DeGirum SDK.
-
Stream Processed Video:
- Serve the processed frames over HTTP or WebSocket using FastAPI.
- Implement an endpoint in order to view the real-time video stream with inference results.
To set up and run the application:
-
Install DeGirum SDK:
- Do the guided installation for DeGirum SDK.
-
Activate the virtual environment:
source degirum_env/bin/activate -
Install requirements dependencies
pip install fastapi uvicorn degirum degirum_tools
-
Clone my repo:
git clone https://github.com/PiWebswiss/raspberry_PI5_hailo.git cd raspberry_PI5_hailoThen, go to the file directory
Webcam,WebSocketorHTTPusingcd <path>. -
Run the FastAPI Server:
uvicorn main:app --host 0.0.0.0 --port 8000
-
Access the Video Stream:
- Open a web browser and navigate to
http://127.0.0.1:8001/to view the AI-processed video stream.
- Open a web browser and navigate to
- Hardware Requirements:
- A Raspberry Pi 5 with the Hailo8L AI accelerator.


