-
Notifications
You must be signed in to change notification settings - Fork 427
Prometheus目标检测算法 目标检测 点击跟踪
Ren Jin edited this page Mar 31, 2022
·
2 revisions
Prometheus目标检测+点击跟踪使用教程如下图所示:
具体请参考相应链接:
注意,运行Yolov5-TensorRT需要安装CUDA、TensorRT,如果没有安装,请参考附录1
先看速度测试:
平台 | Yolov5模型 | 输入分辨率 | 检测帧率 |
---|---|---|---|
Nvidia GTX 1080Ti | yolov5s | 608 | 65.2 |
Nvidia Jetson Xavier NX | yolov5s | 608 | 27.1 |
首先安装2个依赖项:
# 安装Opencv
sudo apt-get install libopencv-dev
# 安装pycuda
pip3 install pycuda
在Prometheus目录下,输入:
cd <path-to-prometheus>
chmod +x ./Scripts/install_detection_yolov5tensorrt.sh
./Scripts/install_detection_yolov5tensorrt.sh
或者输入以下命令:
git clone https://gitee.com/jario-jin/prometheus-yolov5-tensorrt.git Modules/object_detection_yolov5tensorrt
cd Modules/object_detection_yolov5tensorrt
pip3 install -r requirements.txt
下载训练好的权重文件,以官方权重yolov5s.pt
为例,用如下代码生成yolov5s.wts
文件
cd <path-to-prometheus>/Modules/object_detection_yolov5tensorrt
python3 gen_wts.py
编译tensorrtx-yolov5:
cd <path-to-prometheus>/Modules/object_detection_yolov5tensorrt
mkdir build
cd build
cmake ..
make
sudo ./yolov5 -s # 生成yolov5s.engine文件
启动yolov5-tensorrt服务端(负责读取摄像头,检测目标)
cd <path-to-prometheus>
chmod +x ./Scripts/start_yolov5tensorrt_server.sh
./Scripts/start_yolov5tensorrt_server.sh
启动yolov5-tensorrt客户端(负责从服务端读取检测结果,并发布ros消息)
roslaunch prometheus_detection yolov5_nvidia_tensorrt.launch
- 点击鼠标左键开始跟踪目标,点击鼠标右键取消跟踪,恢复到检测模式
以CUDA10.0为例,进入CUDA下载官网https://developer.nvidia.com/cuda-10.0-download-archive
,选择Linux→x86_64→Ubuntu→18.04→deb(local)下载.deb格式安装包,然后运行以下指令:
cd Downloads
sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
如果遇到依赖错误,可采用aptitude安装:
sudo apt-get install aptitude
sudo aptitude install cuda
以Tensorrt7.0.0为例,进入Tensorrt下载官网https://developer.nvidia.com/nvidia-tensorrt-7x-download
,选择Tensorrt 7.0.0.11 for Ubuntu 1804 and CUDA 10.0 DEB local repo packages
下载.deb格式安装包,然后运行以下指令:
sudo dpkg -i nv-tensorrt-repo-ubuntu1804-cuda10.0-trt7.0.0.11-ga-20191216_1-1_amd64.deb
sudo apt-get update
sudo apt-get install tensorrt
感谢使用Prometheus自主无人机软件平台!