This repository is a ROS2 package that performs object detection using YOLOv8 with ONNX.
Subscribed Topic:
- Image-stream :
sensor_msgs/msg/Image
Published Topic:
- Image-stream with bounding box around detected objects :
sensor_msgs/msg/Image
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
ros2 launch yolo_v8 detection.xml
-
EUROC dataset experiment with Workstation CPU
-
Real-life situation experiment with Raspi5-robot (real-time)
- TBD
- Minje Kim ([email protected])