Skip to content

Commit

Permalink
yolov12 added
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Feb 21, 2025
1 parent 54bd39c commit 77af02c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions yolo_bringup/launch/yolov12.launch.py
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.


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(),
)
]
)
2 changes: 1 addition & 1 deletion yolo_ros/yolo_ros/detect_3d_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 77af02c

Please sign in to comment.