Skip to content

ROS2 package that performs object detection using YOLOv8 with ONNX

License

Notifications You must be signed in to change notification settings

minje-KIM/YOLOv8_ONNX_ROS2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

ROS2 package that performs object detection using YOLOv8 with ONNX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages