This is an old revision of the document!
This document describes how to compile and run the object detection demo with RTSP streaming on the Khadas Edge-2L using its NPU (Neural Processing Unit).
Before building the project, ensure your system is up to date and the required dependencies are installed:
sudo apt update sudo apt install cmake libopencv-dev
Clone the official Khadas Edge-2L NPU repository:
git clone https://github.com/khadas/edge-2l-npu cd edge-2l-npu
Compile the project using the provided build script:
bash build.sh
Before running the demo, ensure an RTSP server is running in your local network. You can use [https://github.com/bluenviron/mediamtx MediaMTX] or other RTSP servers.
wget https://github.com/bluenviron/mediamtx/releases/download/v1.11.3/mediamtx_v1.11.3_linux_amd64.tar.gz tar -xzf mediamtx_v1.11.3_linux_amd64.tar.gz cd mediamtx ./mediamtx
By default, MediaMTX listens on port 8554. Once started, it's ready to receive RTSP streams.
ffmpeg -re -stream_loop -1 -i input.mp4 -c:v copy -an -f rtsp rtsp://<RTSP_SERVER_IP>:8554/live/stream
Replace <RTSP_SERVER_IP> with the IP address of the machine running MediaMTX.
Navigate to the output directory and run the demo:
cd install/object_detection+RTSP ./object_detection+RTSP data/model/yolov8n.rknn 33 rtsp://<RTSP_SERVER_IP>:8554/live/stream
data/model/yolov8n.rknn # Path to RKNN model file 33 # Camera device index (e.g., /dev/video33) rtsp://<RTSP_SERVER_IP>:8554/... # RTSP server address
You may use one of the following RTSP servers:
You can verify the RTSP stream using a player such as ffplay or VLC.
Open VLC and go to:
Play
Replace <RTSP_SERVER_IP> with the IP address of the RTSP server (e.g., 192.168.31.19).
/dev/video33) is connected and accessible.ip a or hostname -I