TI
Tinker-Twins/YOLO-ROS-2
Darknet YOLO with ROS 2
Darknet YOLO with ROS 2
![]() |
![]() |
![]() |
|---|---|---|
| Stop Sign Detection - Simulation | Stop Sign Detection - TurtleBot3 | Stop Sign Detection - Remote PC |
Note: The above demonstrations use this repository for controlling TurtleBot3 to obey the stop sign.
Build:
- Make a directory
ROS2_WSto act as your ROS 2 workspace.$ mkdir -p ~/ROS2_WS/src/ - Clone this repository:
$ git clone https://github.com/Tinker-Twins/YOLO-ROS-2.git
- Install
OpenCV(or build from source).$ sudo apt update $ sudo apt install libopencv-dev python3-opencv
- Build the ROS packages (build in
Releasemode to maximize performance).$ cd ~/ROS2_WS $ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
- Source the
setup.bashfile of yourROS2_WS.$ echo "source ~/ROS2_WS/install/setup.bash" >> ~/.bashrc $ source ~/.bashrc
Execute:
$ ros2 launch darknet_ros darknet_ros.launch.pyConfigure:
- Installation configuration can be managed from
CMakeLists.txt.darknet_ros/darknet_ros/darknet/CMakeLists.txt# CUDA/cuDNN Settings option(ENABLE_CUDA "Enable CUDA support" OFF) option(ENABLE_CUDNN "Enable CUDNN" OFF) option(ENABLE_CUDNN_HALF "Enable CUDNN Half precision" OFF)
darknet_ros/darknet_ros/darknet_ros/CMakeLists.txt# CUDA/cuDNN Settings set(CUDA_ENABLE OFF) set(CUDNN_ENABLE OFF) set(FP16_ENABLE OFF) # YOLO Pre-Trained Model (Weights) Settings set(DOWNLOAD_YOLOV2_TINY OFF) set(DOWNLOAD_YOLOV3 OFF) set(DOWNLOAD_YOLOV4 OFF) set(DOWNLOAD_YOLOV4_CSP ON) set(DOWNLOAD_YOLOV4_TINY ON) set(DOWNLOAD_YOLOV4_MISH OFF) set(DOWNLOAD_YOLOV7_TINY ON)
- Names and other parameters of the publishers, subscribers and actions can be modified from
darknet_ros/config/ros.yaml. - Parameters related to YOLO object detection algorithm can be modified from
darknet_ros/darknet_ros/darknet_ros/config/yolo.yaml. - It is recommended to create a copy of the existing configuration file(s) as a template and do necessary modifications.
- Reference the updated configuration file(s) in
darknet_ros/darknet_ros/darknet_ros/launch/darknet_ros.launch.py.
On this page
Languages
C39.8%C++36.1%Python10.3%Cuda9.0%CMake2.5%PowerShell1.1%Shell0.4%Batchfile0.4%C#0.2%Makefile0.2%Dockerfile0.1%
Contributors
Latest Release
v0.1.0April 7, 2023Created April 7, 2023
Updated June 7, 2023


