Skip to content

YOLO v4 + ROS2 Humble (Foxy) + CUDA11 + cuDNN (FP16) #319

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 83 commits into
base: foxy
Choose a base branch
from

Conversation

Ar-Ray-code
Copy link

@Ar-Ray-code Ar-Ray-code commented May 10, 2021

Hello.
I am a college student in Japan and a fan of darknet_ros.

I've been wanting to make the ROS2 + YOLO v4 implementation happen for a long time, and I'm happy to report that I was able to implement it.

Main changes (my commits -> foxy)

  • Support for YOLO v4 : Switched the submodule to the master branch of AlexeyAB/darknet.
  • Removed IPL : Switched from IPL to CV::Mat for OpenCV4 support.
  • cuDNN🔥🔥: supported cuDNN & FP16

Requirements

  • ROS2 Foxy
  • OpenCV4 ($ sudo apt install ros-foxy-vision-opencv)
  • CUDA 10 or 11 (tested with CUDA 11.3)
  • cuDNN 8 (Optional)

Installation

$ source /opt/ros/foxy/setup.bash
$ mkdir -p ~/ros2_ws/src
$ cd ~/ros2_ws/src
$ git clone --recursive  https://github.com/Ar-Ray-code/darknet_ros_yolov4.git
$ darknet_ros_yolov4/darknet_ros/rm_darknet_CMakeLists.sh
$ cd ~/ros2_ws
$ colcon build --symlink-install

Demo

Connect your webcam to your PC.

Terminal

$ source /opt/ros/foxy/setup.bash
$ source ~/ros2_ws/install/local_setup.bash
$ ros2 launch darknet_ros demo-v4-tiny.launch.py

example

Performance

Using YOLO v4 consumes a lot of GPU memory and lowers the frame rate, so you need to pay attention to your PC specs.

Test Machine

Topics Spec
CPU Ryzen7 2700X (@3.7GHz x 16)
RAM 16GB DDR4
GPU NVIDIA GeForce RTX 2080 Ti (GDDR6 11GB)
Driver 460.32.03

Performance

YOLO v3 : 67 fps (72 ~ 62 fps), uses 1781MB of VRAM
YOLO v4 : 29 fps (27 ~ 30.5 fps), uses 3963MB of VRAM

Please give it a try. Thank you.

tomasgareau and others added 30 commits January 31, 2020 16:37
Adds the `launch`, `config`, and `yolo_network_config` folders to the
install target for `darknet_ros` so they are available in the catkin
install directory.
Add install targets for configuration files
@Ar-Ray-code
Copy link
Author

Changed CMakeLists.txt to work correctly on CPU.
OpenMP is used.
706dce0

@Ar-Ray-code
Copy link
Author

Did you devel on top of the master or the foxy branch, @Ar-Ray-code? Could you rebase such that only your changes are included?

I develop this on the master branch.

@tomlankhorst tomlankhorst changed the base branch from foxy to master September 29, 2021 10:17
@Ar-Ray-code Ar-Ray-code changed the base branch from master to foxy September 29, 2021 11:35
@Ar-Ray-code
Copy link
Author

Did the build for the GPU work?
If you have any questions, please let me know :)

@Ar-Ray-code
Copy link
Author

I will support ROS-Humble and Ampere architecture.
Are there any plans to create a Humble branch?

@Ar-Ray-code Ar-Ray-code changed the title YOLO v4 + ROS2 Foxy + CUDA11 + cuDNN (FP16) YOLO v4 + ROS2 Humble (Foxy) + CUDA11 + cuDNN (FP16) May 28, 2022
@wanilly
Copy link

wanilly commented Feb 9, 2023

Hello, bro! Your code and advising help us. Thank you so much. I have a error.
Error: CMake Error at /usr/share/cmake-3.16/Modules/FindCUDA.cmake:707 (message):
Specify CUDA_TOOLKIT_ROOT_DIR

So, it is not building colcon. How can I solve problem. Help me!!

--> Feb 9 17:18 in korea : I guess CUDA version problem. I have another issuse.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants