NOTE: This assumes you already have ROS Kinetic installed on Ubuntu 16.04.
cd ~/ && git clone [email protected]:pjreddie/darknet.git
If you want to run darknet-yolov3 without CUDA, skip this section. You will need to change the makefile to GPU=0
to suppress checking for cuda.
To install CUDA follow the instructions here: install_cuda.sh, also in the scripts folder. (NOTE: this is a guide file in shell script format, it is not meant to be run as a single terminal command.)
There are five make options in ~/darknet/Makefile :
GPU=1
CUDNN=1
OPENCV=1
OPENMP=0
DEBUG=0
Setting GPU=0 and OPENCV=0 turns off the build to ignore opencv and cuda/gpu processing. This installation assumes ROS kinetic is already installed, which has opencv bundled. To find the ROS ported version of dakrnet, see this repo
#ARCH= -gencode arch=compute_30,code=sm_30 \
#-gencode arch=compute_35,code=sm_35 \
#-gencode arch=compute_50,code=[sm_50,compute_50] \
#-gencode arch=compute_52,code=[sm_52,compute_52]
#-gencode arch=compute_20,code=[sm_20,sm_21] \ This one is deprecated?
# This is what I use for my Quadro M2000 video card
ARCH= -gencode arch=compute_50,code=sm_50
# This is what I use for my P4000 video card
ARCH= -gencode arch=compute_61,code=sm_61
If everything went well, you should be able to generate a report using nvidia-smi
from the command line. Mine looks like this:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.79 Driver Version: 410.79 CUDA Version: 10.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Quadro M2000 Off | 00000000:01:00.0 On | N/A |
| 55% 42C P0 24W / 75W | 392MiB / 4040MiB | 1% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1157 G /usr/lib/xorg/Xorg 166MiB |
| 0 1561 G /usr/bin/gnome-shell 219MiB |
| 0 2003 G /usr/lib/firefox/firefox 1MiB |
+-----------------------------------------------------------------------------+
cd ~/darknet && make 2>&1 | tee make_log.out
If there are issues or for further help with the installation, see the darknet install page: Darknet install page.
./darknet
Examples can be found in the scripts folder, following the test_darknet.sh file.
test opencv:
./darknet imtest data/eagle.jpg
Change the following line in ~/darknet/python/darknet.py:
lib = CDLL("libdarknet.so", RTLD_GLOBAL)
to
lib = CDLL("/home/you/darknet/libdarknet.so", RTLD_GLOBAL)
Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.
For more information see the Darknet project website.
For questions or issues please use the Google Group.