diff --git a/README.md b/README.md index 0193bd6..61ceb7e 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ The compatible models for yolo_ros are the following: - [YOLOv9](https://docs.ultralytics.com/models/yolov9/) - [YOLOv10](https://docs.ultralytics.com/models/yolov10/) - [YOLOv11](https://docs.ultralytics.com/models/yolo11/) +- [YOLOv12](https://docs.ultralytics.com/models/yolo12/) - [YOLO-World](https://docs.ultralytics.com/models/yolo-world/) ## Usage @@ -85,6 +86,12 @@ ros2 launch yolo_bringup yolov10.launch.py ros2 launch yolo_bringup yolov11.launch.py ``` +### YOLOv12 + +```shell +ros2 launch yolo_bringup yolov12.launch.py +``` + ### YOLO-World ```shell diff --git a/requirements.txt b/requirements.txt index 4e81462..b9d8450 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ numpy<2 opencv-python>=4.8.1.78 typing-extensions>=4.4.0 -ultralytics==8.3.26 +ultralytics==8.3.78 lap==0.4.0 \ No newline at end of file diff --git a/yolo_bringup/launch/yolov12.launch.py b/yolo_bringup/launch/yolov12.launch.py new file mode 100644 index 0000000..d46a8a3 --- /dev/null +++ b/yolo_bringup/launch/yolov12.launch.py @@ -0,0 +1,53 @@ +# Copyright (C) 2024 Miguel Ángel González Santamarta + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +import os +from launch import LaunchDescription +from launch.substitutions import LaunchConfiguration +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from ament_index_python.packages import get_package_share_directory + + +def generate_launch_description(): + + return LaunchDescription( + [ + IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join( + get_package_share_directory("yolo_bringup"), + "launch", + "yolo.launch.py", + ) + ), + launch_arguments={ + "model": LaunchConfiguration("model", default="yolo12m.pt"), + "tracker": LaunchConfiguration("tracker", default="bytetrack.yaml"), + "device": LaunchConfiguration("device", default="cuda:0"), + "enable": LaunchConfiguration("enable", default="True"), + "threshold": LaunchConfiguration("threshold", default="0.5"), + "input_image_topic": LaunchConfiguration( + "input_image_topic", default="/camera/rgb/image_raw" + ), + "image_reliability": LaunchConfiguration( + "image_reliability", default="2" + ), + "namespace": LaunchConfiguration("namespace", default="yolo"), + }.items(), + ) + ] + ) diff --git a/yolo_ros/yolo_ros/detect_3d_node.py b/yolo_ros/yolo_ros/detect_3d_node.py index 1045bb7..ca7ac99 100644 --- a/yolo_ros/yolo_ros/detect_3d_node.py +++ b/yolo_ros/yolo_ros/detect_3d_node.py @@ -196,7 +196,7 @@ def process_detections( return [] new_detections = [] - depth_image = self.cv_bridge.imgmsg_to_cv2(depth_msg, desired_encoding="bgr8") + depth_image = self.cv_bridge.imgmsg_to_cv2(depth_msg, desired_encoding="passthrough") for detection in detections_msg.detections: bbox3d = self.convert_bb_to_3d(depth_image, depth_info_msg, detection)