This is a ROS package developed for object detection in camera images. You only look once (YOLO) is a state-of-the-art, real-time object detection system. In the following ROS package you are able to use YOLO on GPU and CPU. The pre-trained model of the convolutional neural network is able to detect aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, dining table, dog, horse, motorbike, person, potted plant, sheep, sofa, train and tv monitor. For more information about YOLO, Darknet, available training data and training YOLO see the following link: YOLO: Real-Time Object Detection.
The YOLO packages have been tested under ROS Kinetic and Ubuntu 16.04. This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.
Author: Marko Bjelonic, marko.bjelonic@mavt.ethz.ch
Affiliation: Robotic Systems Lab, ETH Zurich
The YOLO methods used in this software are described in the paper: You Only Look Once: Unified, Real-Time Object Detection.
This software is built on the Robotic Operating System ([ROS]), which needs to be installed first. Additionally, YOLO for ROS depends on following software:
- Darknet (open source neural network framework written in C and CUDA)
- OpenCV (computer vision library),
- boost (c++ library),
Darknet on the CPU is fast (approximately 1.5 seconds on an Intel Core i7-6700HQ CPU @ 2.60GHz × 8) but it's like 500 times faster on GPU! You'll have to have an Nvidia GPU and you'll have to install CUDA. The CMakeLists.txt file automatically detects if you have CUDA installed or not. CUDA is a parallel computing platform and application programming interface (API) model created by Nvidia. If you do not have CUDA on your System the build process will switch to the CPU version of YOLO. If you are compiling with CUDA, you might receive the following build error:
nvcc fatal : Unsupported gpu architecture 'compute_61'.
This means that you need to check the compute capability (version) of your GPU. You can find a list of supported GPUs in CUDA here: CUDA - WIKIPEDIA. Simply find the compute capability of your GPU and replace in darknet2_ros/CMakeLists.txt the version number 61 with your version number:
-O3 -gencode arch=compute_61,code=sm_61
In order to install darknet2_ros, clone the latest version from this repository into your catkin workspace and compile the package using ROS.
cd catkin_workspace/src
git clone --recursive git@github.com:leggedrobotics/darknet2_ros.git
cd ../
catkin build darknet2_ros
The yolo-voc.weights and tiny-yolo-voc.weights are downloaded automatically in the CMakeLists.txt file. If you need to download them again, go into the weights folder and download the two pre-trained weights
cd catkin_workspace/src/darknet2_ros/darknet2_ros/weights/
wget http://pjreddie.com/media/files/yolo-voc.weights
wget http://pjreddie.com/media/files/tiny-yolo-voc.weights
Run the unit tests with
catkin build darknet2_ros --no-deps --verbose --catkin-make-args run_tests
You will see the following two figures popping up :