Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.32 KB

README.md

File metadata and controls

38 lines (33 loc) · 1.32 KB

YOLOv8 ROS2 Wrapper

NOTE: This package is tested on Jetson Xavier AGX with Jetpack 5.1.3, ROS2 Foxy and Python3.8 using YOLOv8 object detection model only.

System Requirement

  1. Python >= 3.8
  2. ROS2 Foxy/Humble
  3. Ubuntu 20/22

Installation

  1. First install PyTorch on the machine (for Python and C++ LibTorch). For NVIDIA Jetson, follow the instruction at https://forums.developer.nvidia.com/t/installing-pytorch-for-cuda-10-2-on-jetson-xavier-nx-for-yolov5/183868/2 for installation.
  2. Obtain a pretrained model in torchscript format (.torchscript/.torchscript.pt). Follow instructions in YOLOv8 export.

Run

  1. Clone this project to your ROS2 workspace
cd ~/ros2_ws/src
git clone https://github.com/joewong00/yolov8-ros2-wrapper.git yolov8_wrapper
  1. Ensure both torchscript model and a class lists file (coco.names) is present, modify the path to both of the files in the launch file.
  2. Install ROS dependencies
cd ../
sudo rosdep init
rosdep update
rosdep install --from-paths src -y --ignore-src
  1. Build the package
colcon build --symlink-install
  1. Run the detector
ros2 launch yolov8_wrapper detect.launch.py

Reference

https://github.com/ultralytics/ultralytics/tree/main/examples/YOLOv8-LibTorch-CPP-Inference