下载:
git clone https://github.com/pjreddie/darknet
cd darknet
对darknet/example/darknet.c main()部分添加两行代码,如下所示:
printf("argc = %d\n", argc);
for(int i = 0; i < argc; i ++)
printf("%d, %s\n", i, argv[i]);
进行编译:
make
下载yolov3预先训练的权重:
wget https://pjreddie.com/media/files/yolov3.weights
测试检测器:
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
结果如下所示:
argc = 5
0, ./darknet
1, detect
2, cfg/yolov3.cfg
3, yolov3.weights
4, data/dog.jpg
layer filters size input output
0 conv 32 3 x 3 / 1 608 x 608 x 3 -> 608 x 608 x 32 0.639 BFLOPs
1 conv 64 3 x 3 / 2 608 x 608 x 32 -> 304 x 304 x 64 3.407 BFLOPs
2 conv 32 1 x 1 / 1 304 x 304 x 64 -> 304 x 304 x 32 0.379 BFLOPs
3 conv 64 3 x 3 / 1 304 x 304 x 32 -> 304 x 304 x 64 3.407 BFLOPs
4 res 1 304 x 304 x 64 -> 304 x 304 x 64
5 conv 128 3 x 3 / 2 304 x 304 x 64 -> 152 x 152 x 128 3.407 BFLOPs
6 conv 64 1 x 1 / 1 152 x 152 x 128 -> 152 x 152 x 64 0.379 BFLOPs
7 conv 128 3 x 3 / 1 152 x 152 x 64 -> 152 x 152 x 128 3.407 BFLOPs
8 res 5 152 x 152 x 128 -> 152 x 152 x 128
9 conv 64 1 x 1 / 1 152 x 152 x 128 -> 152 x 152 x 64 0.379 BFLOPs
10 conv 128 3 x 3 / 1 152