This is a sample showing how to integrate YOLOv5 with Nvidia Isaac ROS DNN Inference.

Tested on Jetson Orin running JetPack 5.0.2 and Intel RealSense D435 Webcam. - ROS2 Humble
Use the Isaac ROS Dev Docker for development. This provides an environment with all dependencies installed to run Isaac ROS packages.
Refer to the license terms for the YOLOv5 project before using this software and ensure you are using YOLOv5 under license terms compatible with your project requirements.
input and output names - these will be used to run the node. For instance, images for input and output0 for output. Also note input dimensions, for instance, (1x3x640x640).workspaces/isaac_ros-dev. Clone this repository and its dependencies under workspaces/isaac_ros-dev/src:cd ~/workspaces/isaac_ros-dev/src
git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common.git
git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_nitros.git
git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_dnn_inference.git
git clone https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_image_pipeline
git clone https://github.com/NVIDIA-AI-IOT/YOLOv5-with-Isaac-ROS.git
workspaces/isaac_ros-dev/src.yolov5s.onnx) from above to workspaces/isaac_ros-dev/src.cd ~/workspaces/isaac_ros-dev/src/isaac_ros_common
./scripts/run_dev.sh
pip install -r src/requirements.txt
$torchvision_tag below:git clone https://github.com/pytorch/vision.git
cd vision
git checkout $torchvision_tag
pip install -v .
yolov5_isaac_ros folder of this repository.
Finally, your file structure should look like this (all files not shown here):.
+- workspaces
+- isaac_ros-dev
+- src
+- requirements.txt
+- yolov5s.onnx
+- isaac_ros_common
+- YOLOv5-with-Isaac-ROS
+- README
+- launch
+- images
+- yolov5_isaac_ros
+- utils
+- Yolov5Decoder.py
+- Yolov5DecoderUtils.py
Refer to the license terms for the YOLOv5 project before using this software and ensure you are using YOLOv5 under license terms compatible with your project requirements.
utils/general.py, utils/torch_utils.py and utils/metrics.py after downloading utils from the Ultralytics YOLOv5 project:yolov5_isaac_ros before utils. For instance - change from utils.metrics import box_iou to from yolov5_isaac_ros.utils.metrics import box_ioucd /workspaces/isaac_ros-dev
colcon build --symlink-install
source install/setup.bash
ros2 launch realsense2_camera rs_launch.py/camera/color/image_raw. You could use RQt/Foxglove for this or use this command in another terminal inside the container:
ros2 topic echo /camera/color/image_rawisaac_ros_yolov5_tensor_rt launch file. This launches the DNN image encoder node, TensorRT inference node and YOLOv5 decoder node. It also launches a visualization script that shows results on RQt. Use the names noted above in Model preparation as input_binding_names and output_binding_names (for example, images for input_binding_names and output0 for output_binding_names). Similarly, use the input dimensions noted above as network_image_width and network_image_height:ros2 launch yolov5_isaac_ros isaac_ros_yolov5_tensor_rt.launch.py model_file_path:=/workspaces/isaac_ros-dev/src/yolov5s.onnx engine_file_path:=/workspaces/isaac_ros-dev/src/yolov5s.plan input_binding_names:=['images'] output_binding_names:=['output0'] network_image_width:=640 network_image_height:=640
yolov5s.plan is generated and saved in workspaces/isaac_ros-dev/src/ after running the command above:ros2 launch yolov5_isaac_ros isaac_ros_yolov5_tensor_rt.launch.py engine_file_path:=/workspaces/isaac_ros-dev/src/yolov5s.plan input_binding_names:=['images'] output_binding_names:=['output0'] network_image_width:=640 network_image_height:=640
/camera/color/image_raw.tensor_pub.tensor_sub.object_detections as a Detection2DArray message. isaac_ros_yolov5_visualizer.py subscribes to topics camera/color/image_raw from the camera node and object_detections from the decoder node. It publishes images with the resulting bounding boxes on topic yolov5_processed_image.yolov5_processed_image. These images will contain bounding boxes, object classes and detection scores around detected objects. You could also use Foxglove to view images on yolov5_processed_image.
yolov5s.onnx) to a TensorRT plan file named model.plan using trtexec. To do this, run the following command from /usr/src/tensorrt/bin and save the generated file under yolov5/1/ of this project. cd /usr/src/tensorrt/bin
./trtexec --onnx=yolov5s.onnx --saveEngine=<absolute-path-to-save-location> --fp16
.
+- workspaces
+- isaac_ros-dev
+- src
+- isaac_ros_common
+- YOLOv5-with-Isaac-ROS
+- README
+- launch
+- yolov5
+- config.pbtxt
+- 1
+- model.plan
network_image_width and network_image_height as explained for the TensorRT node above): ros2 launch yolov5_isaac_ros isaac_ros_yolov5_triton.launch.py network_image_width:=640 network_image_height:=640
Visit Isaac ROS DNN Inference for more information about the Image encoder, TensorRT and Triton nodes.
Parameters like the confidence threshold can be specified in the decoder_params.yaml file under the yolov5-isaac-ros-dnn/config folder. Below is a description of each parameter:
- conf_thres: Detection confidence threshold
- iou_thres: IOU threshold
- max_det: Maximum number of detections per image
Please reach out regarding issues and suggestions here.
$ claude mcp add YOLOv5-with-Isaac-ROS \
-- python -m otcore.mcp_server <graph>