mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-23 00:26:33 +00:00
Enables use of multiple TPUs in OPI5
This commit is contained in:
@@ -2,14 +2,32 @@
|
||||
|
||||
`rtsp_ai_player` is an application that listens to an RTSP stream, analyzes images with an AI model, and shows the results visually. It also controls a gimbal camera to zoom in on the recognized objects. Application uses YOLOv8 AI models converted to the ONNX format.
|
||||
|
||||
### How to convert PT file to ONNX format
|
||||
### How to convert Azaion AI model file to ONNX format
|
||||
```bash
|
||||
yolo export model=azaion-2024-06-28.pt dynamic=False format=onnx imgsz=640,640
|
||||
```
|
||||
|
||||
## How to use application locally on a Linux PC.
|
||||
|
||||
### Install ONNX runtime
|
||||
# Speed up compilations
|
||||
```bash
|
||||
echo "export MAKEFLAGS=\"-j8\"" >> ~/.bashrc
|
||||
echo "export PATH=/usr/lib/ccache:\$PATH" >> ~/.bashrc
|
||||
```
|
||||
|
||||
### Install OpenCV 4.10.0
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install libgtk-3-dev libpng-dev cmake ffmpeg libavcodec-dev libavformat-dev libavfilter-dev
|
||||
wget https://github.com/opencv/opencv/archive/refs/tags/4.10.0.zip
|
||||
unzip 4.10.0.zip
|
||||
cd opencv-4.10.0
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/opt/opencv-4.10.0 -DBUILD_opencv_world=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF ..
|
||||
make -j8 && sudo make install
|
||||
```
|
||||
|
||||
### Install ONNX runtime 1.18.0
|
||||
```bash
|
||||
wget https://github.com/microsoft/onnxruntime/releases/download/v1.18.0/onnxruntime-linux-x64-1.18.0.tgz
|
||||
sudo tar xf onnxruntime-linux-x64-1.18.0.tgz -C /opt
|
||||
@@ -24,15 +42,20 @@ mkdir mediamtx
|
||||
tar xf mediamtx_v1.8.4_linux_amd64.tar.gz -C mediamtx
|
||||
```
|
||||
|
||||
### Launch mediamtx RTSP server:
|
||||
### If you use video file from the local RTSP server:
|
||||
```bash
|
||||
cd mediamtx
|
||||
./mediamtx
|
||||
```
|
||||
|
||||
### Play mp4 video file from RTSP server:
|
||||
### Play Azaion mp4 video file from RTSP server ... :
|
||||
```bash
|
||||
ffmpeg -re -stream_loop -1 -i $HOME/azaion/models/videos/for_ai_short.mp4 -c copy -f rtsp rtsp://localhost:8554/live.stream
|
||||
ffmpeg -re -stream_loop -1 -i $HOME/azaion/videos/for_ai_cut.mp4 -c copy -f rtsp rtsp://localhost:8554/live.stream
|
||||
```
|
||||
|
||||
### ... or play simple video file from RTSP server:
|
||||
```bash
|
||||
ffmpeg -re -stream_loop -1 -i $HOME/azaion/videos/table.mp4 -c copy -f rtsp rtsp://localhost:8554/live.stream
|
||||
```
|
||||
|
||||
### Test RTSP streaming with ffplay:
|
||||
@@ -40,7 +63,14 @@ ffmpeg -re -stream_loop -1 -i $HOME/azaion/models/videos/for_ai_short.mp4 -c cop
|
||||
ffplay -rtsp_transport tcp rtsp://localhost:8554/live.stream
|
||||
```
|
||||
|
||||
### Compile and run rtsp_ai_player:
|
||||
### Compile and run rtsp_ai_player with YOLOv8 medium AI mode:
|
||||
```bash
|
||||
cd autopilot/misc/rtsp_ai_player
|
||||
qmake6 && make
|
||||
./rtsp_ai_player ~/azaion/models/onnx/yolov8m.onnx
|
||||
```
|
||||
|
||||
### Compile and run rtsp_ai_player with Azaion AI mode:
|
||||
```bash
|
||||
cd autopilot/misc/rtsp_ai_player
|
||||
qmake6 && make
|
||||
|
||||
Reference in New Issue
Block a user