MyGit

mgonzs13/yolo_ros

Fork: 89 Star: 339 (更新于 2024-11-05 02:11:25)

license: GPL-3.0

Language: Python .

Ultralytics YOLOv8, YOLOv9, YOLOv10, YOLOv11 for ROS 2

最后发布版本: 3.3.3 ( 2024-09-03 19:11:12)

GitHub网址

yolo_ros

ROS 2 wrap for YOLO models from Ultralytics to perform object detection and tracking, instance segmentation, human pose estimation and Oriented Bounding Box (OBB). There are also 3D versions of object detection, including instance segmentation, and human pose estimation based on depth images.

Table of Contents

  1. Installation
  2. Docker
  3. Models
  4. Usage
  5. Demos

Installation

$ cd ~/ros2_ws/src
$ git clone https://github.com/mgonzs13/yolo_ros.git
$ pip3 install -r yolo_ros/requirements.txt
$ cd ~/ros2_ws
$ rosdep install --from-paths src --ignore-src -r -y
$ colcon build

Docker

Build the yolo_ros docker.

$ docker build -t yolo_ros .

Run the docker container. If you want to use CUDA, you have to install the NVIDIA Container Tollkit and add --gpus all.

$ docker run -it --rm --gpus all yolo_ros

Models

The compatible models for yolo_ros are the following:

Usage

Click to expand

YOLOv5

$ ros2 launch yolo_bringup yolov5.launch.py

YOLOv8

$ ros2 launch yolo_bringup yolov8.launch.py

YOLOv9

$ ros2 launch yolo_bringup yolov9.launch.py

YOLOv10

$ ros2 launch yolo_bringup yolov10.launch.py

YOLOv11

$ ros2 launch yolo_bringup yolov11.launch.py

YOLO-NAS

$ ros2 launch yolo_bringup yolo-nas.launch.py

YOLO-World

$ ros2 launch yolo_bringup yolo-world.launch.py

Topics

  • /yolo/detections: Objects detected by YOLO using the RGB images. Each object contains a bounding box and a class name. It may also include a mark or a list of keypoints.
  • /yolo/tracking: Objects detected and tracked from YOLO results. Each object is assigned a tracking ID.
  • /yolo/detections_3d: 3D objects detected. YOLO results are used to crop the depth images to create the 3D bounding boxes and 3D keypoints.
  • /yolo/debug_image: Debug images showing the detected and tracked objects. They can be visualized with rviz2.

Parameters

These are the parameters from the yolo.launch.py, used to launch all models. Check out the Ultralytics page for more details.

  • model_type: Ultralytics model type (default: YOLO)
  • model: YOLO model (default: yolov8m.pt)
  • tracker: tracker file (default: bytetrack.yaml)
  • device: GPU/CUDA (default: cuda:0)
  • enable: whether to start YOLO enabled (default: True)
  • threshold: detection threshold (default: 0.5)
  • iou: intersection Over Union (IoU) threshold for Non-Maximum Suppression (NMS) (default: 0.7)
  • imgsz_height: image height for inference (default: 480)
  • imgsz_width: image width for inference (default: 640)
  • half: whether to enable half-precision (FP16) inference speeding up model inference with minimal impact on accuracy (default: False)
  • max_det: maximum number of detections allowed per image (default: 300)
  • augment: whether to enable test-time augmentation (TTA) for predictions improving detection robustness at the cost of speed (default: False)
  • agnostic_nms: whether to enable class-agnostic Non-Maximum Suppression (NMS) merging overlapping boxes of different classes (default: False)
  • retina_masks: whether to use high-resolution segmentation masks if available in the model, enhancing mask quality for segmentation (default: False)
  • input_image_topic: camera topic of RGB images (default: /camera/rgb/image_raw)
  • image_reliability: reliability for the image topic: 0=system default, 1=Reliable, 2=Best Effort (default: 2)
  • input_depth_topic: camera topic of depth images (default: /camera/depth/image_raw)
  • depth_image_reliability: reliability for the depth image topic: 0=system default, 1=Reliable, 2=Best Effort (default: 2)
  • input_depth_info_topic: camera topic for info data (default: /camera/depth/camera_info)
  • depth_info_reliability: reliability for the depth info topic: 0=system default, 1=Reliable, 2=Best Effort (default: 2)
  • target_frame: frame to transform the 3D boxes (default: base_link)
  • depth_image_units_divisor: divisor to convert the depth image into meters (default: 1000)
  • maximum_detection_threshold: maximum detection threshold in the z-axis (default: 0.3)
  • use_tracking: whether to activate tracking after detection (default: True)
  • use_3d: whether to activate 3D detections (default: False)
  • use_debug: whether to activate debug node (default: True)

Lifecycle Nodes

Previous updates add Lifecycle Nodes support to all the nodes available in the package. This implementation tries to reduce the workload in the unconfigured and inactive states by only loading the models and activating the subscriber on the active state.

These are some resource comparisons using the default yolov8m.pt model on a 30fps video stream.

State CPU Usage (i7 12th Gen) VRAM Usage Bandwidth Usage
Active 40-50% in one core 628 MB Up to 200 Mbps
Inactive ~5-7% in one core 338 MB 0-20 Kbps

YOLO 3D

$ ros2 launch yolo_bringup yolov8.launch.py use_3d:=True

Demos

Object Detection

This is the standard behavior of yolo_ros which includes object tracking.

$ ros2 launch yolo_bringup yolo.launch.py

Instance Segmentation

Instance masks are the borders of the detected objects, not all the pixels inside the masks.

$ ros2 launch yolo_bringup yolo.launch.py model:=yolov8m-seg.pt

Human Pose

Online persons are detected along with their keypoints.

$ ros2 launch yolo_bringup yolo.launch.py model:=yolov8m-pose.pt

3D Object Detection

The 3D bounding boxes are calculated by filtering the depth image data from an RGB-D camera using the 2D bounding box. Only objects with a 3D bounding box are visualized in the 2D image.

$ ros2 launch yolo_bringup yolo.launch.py use_3d:=True

3D Object Detection (Using Instance Segmentation Masks)

In this, the depth image data is filtered using the max and min values obtained from the instance masks. Only objects with a 3D bounding box are visualized in the 2D image.

$ ros2 launch yolo_bringup yolo.launch.py model:=yolov8m-seg.pt use_3d:=True

3D Human Pose

Each keypoint is projected in the depth image and visualized using purple spheres. Only objects with a 3D bounding box are visualized in the 2D image.

$ ros2 launch yolo_bringup yolo.launch.py model:=yolov8m-pose.pt use_3d:=True

最近版本更新:(数据更新于 2024-09-12 04:34:50)

2024-09-03 19:11:12 3.3.3

2024-08-29 16:44:07 3.3.2

2024-08-21 16:47:37 3.3.1

2024-08-02 16:39:23 3.3.0

2024-07-22 22:45:09 3.2.0

2024-06-21 04:56:11 3.1.1

2024-06-05 21:28:16 3.1.0

2024-04-30 18:01:25 3.0.2

2024-04-09 16:49:07 3.0.0

2024-03-18 23:33:21 2.2.2

主题(topics):

3d-human-pose-estimation, 3d-object-detection, human-pose-estimation, instance-segmentation, obb, object-detection, object-tracking, oriented-bounding-box, ros2, ultralytics, yolo-nas, yolov10, yolov11, yolov8, yolov9

mgonzs13/yolo_ros同语言 Python最近更新仓库

2024-11-22 02:39:01 goauthentik/authentik

2024-11-22 00:03:47 comfyanonymous/ComfyUI

2024-11-21 22:06:18 rashevskyv/dbi

2024-11-21 21:09:02 xtekky/gpt4free

2024-11-21 20:03:58 ultralytics/ultralytics

2024-11-21 00:54:04 hect0x7/JMComic-Crawler-Python