Darknet/yolo wrapped in a ros-package for running Darknet/Yolo with ROS. All credit goes to Joseph Chet Redmon - you might enjoy his resume - and co. for implementing a deep learning framework Darknet and the super fast object detector YOLO and YOLO9000.
The make-file have been converted to a CMakeLists. (Code test on ubuntu 16.04, cuda 8, opencv 3.2.0-dev, ROS kinetic)
Follow the ROS installation guide for download and installation and ROS tutorials for creating a workspace.
Go to ros-workspace source folder in a terminal
cd [workspace]/src/
Clone folder in terminal.
The repository needs to be updated.
$ git clone https://github.com/PeteHeine/DarknetROS
Download yolo model to directory the weight directory.
cd [workspace]/src/DarknetROS
mkdir weights
cd weigths
wget http://pjreddie.com/media/files/yolo.weights
Test yolo without ROS, without opencv and without GPU.
cd [workspace]/src/DarknetROS
make
./darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg
To run with GPU and opencv. Open Makefile, set GPU=1 and OPENCV=1 and make agian.
Open [workspace]/src/DarknetROS/CMakeList.txt and ensure that
set(OPENCV 1)
set(ROS_INTERFACE 1)
Open [workspace]/src/DarknetROS/CMakeList.txt and ensure that
set(GPU 0)
Software requires CUDA to be installed. Go to download page select your platform, download and follow instructions.
Open [workspace]/src/DarknetROS/CMakeList.txt and ensure that
set(GPU 1)
Go to workspace and run catkin make.
cd [workspace]
catkin_make
Clone usb_cam ros package to workspace. Go again to ros-workspace source folder.
cd [workspace]/src/
Clone folder
git clone https://github.com/bosch-ros-pkg/usb_cam.git
Build packages
cd [workspace]
catkin_make
Source ros-workspace
source devel/setup.bash
Find the pre-trained model on the following page or simply use a direct link. For a smaller model use direct link
Move file to weight-folder
cd [workspace]/src/DarknetROS
(mkdir weights)
# Normal model
cp ~/Downloads/yolo.weights ./weights
# Fast model
cp ~/Downloads/tiny-yolo-voc.weights ./weights/
Run launch file
roslaunch darknet_ros RunWebCamAndYolo.launch