This is a ROS interface for using YOLOv5 for real time object detection on a ROS image topic. It supports inference on multiple deep learning frameworks used in the official YOLOv5 repository.
This package is built and tested on Ubuntu 20.04 LTS and ROS Noetic with Python 3.8.
cd <ros_workspace>/src
git clone https://github.com/mats-robotics/detection_msgs.git
git clone --recurse-submodules https://github.com/mats-robotics/yolov5_ros.git
cd yolov5_ros/src/yolov5
pip install -r requirements.txt # install the requirements for yolov5
cd <ros_workspace>
catkin build yolov5_ros # build the ROS package
cd <ros_workspace>/src/yolov5_ros/src
chmod +x detect.py
Change the parameter for input_image_topic
in launch/yolov5.launch to any ROS topic with message type of sensor_msgs/Image
or sensor_msgs/CompressedImage
. Other parameters can be modified or used as is.
roslaunch yolov5_ros yolov5.launch
yolov5_ros/src/yolov5
yolov5_ros/src/yolov5/data
weights
, data