參考https://blog.csdn.net/weixin_42747301/article/details/96636614#_76
前提:如果想用GPU,裝好N卡驅動,cuda cudnn opencv再來
下載darknet,下載yolove.weights
git clone https://github.com/pjreddie/darknet
cd darknet
make
wget https://pjreddie.com/media/files/yolov3.weights
在cfg裏面把yolov3.vfg改爲test的batch和sub=1,train註釋掉,測試
如果測試報錯out of memory,就把cfg裏面的圖像大小改一改
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
出現結果:
layer filters size input output
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BFLOPs
1 conv
……
Loading weights from yolov3.weights...Done!
data/dog.jpg: Predicted in 0.142452 seconds.
dog: 99%
truck: 83%
car: 51%
bicycle: 100%
這個時候是沒有GPU啥的
修改darknet目錄下的makefile,
GPU=1
CUDNN=1
OPENCV=1
OPENMP=0
DEBUG=0
ARCH根據自己電腦性能改,實在不知道就用默認的
NVCC=/usr/local/cuda-9.0/bin/nvcc
COMMON+= -DGPU -I/usr/local/cuda-9.0/include/
CFLAGS+= -DGPU
LDFLAGS+= -L/usr/local/cuda-9.0/lib64 -lcuda -lcudart -lcublas -lcurand
改好了之後
sudo make clean
sudo make -j8
重新用狗狗圖片測試(就剛纔那個命令),出結果就說明配置好了