ros-melodic部署YOLOv5

参考

转载:Ubuntu 18.04 YOLOv5 ros_yolo 环境配置 数据集标注
error:out of data

环境

ubuntu1804+ros-melodic+cuda10.2+py3.8+pytouch1.8.1

步骤

一.编译

cd catkin_ws/src
git clone https://github.com/OuyangJunyuan/ros-yolov5.git
git clone https://github.com/catkin/catkin_simple.git
cd ..
catkin_make

二.修改
1.ros-yolov5-master/config/config.yaml

weight: /home/zhao/catkin_yolov5/src/ros-yolov5/model/best.pt

2.src/demo_service_server.py中首行

#!/home/zhao/anaconda3/envs/py3.8_pytouch/bin/python3.8

3.修改yolo_bridge/yolo_bridge.py的line44

self.model = torch.hub.load('ultralytics/yolov5', 'custom', path='/home/zhao/catkin_yolov5/src/ros-yolov5/model/best.pt')

运行

conda activate yolov5
source devel/setup.bash
roslaunch ros_yolo service_demo.launch 

new terminal

source devel/setup.bash
roslaunch ros_yolo service_demo.launch 

可以在service_client_demo.cpp中修改数据来源

bug

运行时回有些奇奇怪怪的bug,看着error修就好了,应该。

demo效果

你可能感兴趣的:(自动驾驶,深度学习,c++)