Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 1.89 KB

README.md

File metadata and controls

66 lines (45 loc) · 1.89 KB

YOLOv8_ONNX_ROS2

ROS2 Ubuntu Python

This repository is a ROS2 package that performs object detection using YOLOv8 with ONNX.

euroc2

ROS Package Configuration

Subscribed Topic:

  • Image-stream : sensor_msgs/msg/Image

Published Topic:

  • Image-stream with bounding box around detected objects : sensor_msgs/msg/Image

image

Installation

You can easily convert using the ultralytics python library.

pip install ultralytics

Please write down a Python file to convert a PyTorch model to ONNX format.

from ultralytics import YOLO

model_name = 'yolov8m' #@param ["yolov8n", "yolov8s", "yolov8m", "yolov8l", "yolov8x"]
input_width = 640 #@param {type:"slider", min:32, max:4096, step:32}
input_height = 480 #@param {type:"slider", min:32, max:4096, step:32}
optimize_cpu = True

model = YOLO(f"{model_name}.pt") 
model.export(format="onnx", imgsz=[input_height,input_width], optimize=optimize_cpu)

Move the ONNX file into the resource folder of the ROS2 package.

mv (yolov8m.onnx) (your_ws)/src/yolo_v8/resources

Usage

ros2 launch yolo_v8 detection.xml

Results

  • EUROC dataset experiment with Workstation CPU

  • Real-life situation experiment with Raspi5-robot (real-time)

    • TBD

References

Developers