一、安装
git clone https://github.com/pjreddie/darknet.git
cd darknet
vim Makefile
将GPU和CUDNN两个设置为1
make
二、Object-Detection
./darknet detect cfg/yolov2-tiny.cfg weights/tiny-yolo.weights data/dog.jpg
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
执行结果如下:
layer filterssize inputoutput
0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs
1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs
3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs
5 max 2 x 2 / 2 104 x 104 x 64 ->52 x 52 x 64
6 conv128 3 x 3 / 152 x 52 x 64 ->52 x 52 x 128 0.399 BFLOPs
7 max 2 x 2 / 252 x 52 x 128 ->26 x 26 x 128
8 conv256 3 x 3 / 126 x 26 x 128 ->26 x 26 x 256 0.399 BFLOPs
9 max 2 x 2 / 226 x 26 x 256 ->13 x 13 x 256
10 conv512 3 x 3 / 113 x 13 x 256 ->13 x 13 x 512 0.399 BFLOPs
11 max 2 x 2 / 113 x 13 x 512 ->13 x 13 x 512
12 conv 1024 3 x 3 / 113 x 13 x 512 ->13 x 13 x1024 1.595 BFLOPs
13 conv512 3 x 3 / 113 x 13 x1024 ->13 x 13 x 512 1.595 BFLOPs
14 conv425 1 x 1 / 113 x 13 x 512 ->13 x 13 x 425 0.074 BFLOPs
15 detection
mask_scale: Using default '1.000000'
Loading weights from weights/tiny-yolo.weights...Done!
data/dog.jpg: Predicted in 1.206671 seconds.
dog: 82%
car: 74%
bicycle: 59%
在当前目录下生成predictions.jpg
三、版本对比
YOLO-v1 在 Pascal VOC-2012 数据集上训练,能识别如下 20 种物体类别:
1)person
2) bird, cat, cow, dog, horse, sheep
3)aeroplane, bicycle, boat, bus, car, motorbike, train
4)bottle, chair, dining table, potted plant, sofa, tv/monitor