darknet - Tiny YOLOv3 test / training (测试 / 训练)

darknet - Tiny YOLOv3 test / training (测试 / 训练)

Tiny YOLOv3 - test

We have a very small model as well for constrained environments, yolov3-tiny. To use this model, first download the weights:

wget https://pjreddie.com/media/files/yolov3-tiny.weights

Then run the detector with the tiny config file and weights:

./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg
strong@foreverstrong:~$ ssh yongqiang@192.168.*.***
yongqiang@192.168.*.***'s password: 
Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.13.0-36-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

20 packages can be updated.
11 updates are security updates.

Last login: Thu Oct 18 20:11:29 2018 from 192.168.1.124
yongqiang@server-sys:~$ 
yongqiang@server-sys:~$ cd darknet_work/darknet_181018/darknet/
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ 
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ make clean

yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ 
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ make

yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ 
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ wget https://pjreddie.com/media/files/yolov3-tiny.weights

yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ cat ./cfg/yolov3-tiny.cfg 
[net]
# Testing
batch=1
subdivisions=1
# Training
# batch=64
# subdivisions=2
width=416
height=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1
./darknet detect ./cfg/yolov3-tiny.cfg ./yolov3-tiny.weights ./data/dog.jpg
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ ./darknet detect ./cfg/yolov3-tiny.cfg ./yolov3-tiny.weights ./data/dog.jpg
layer     filters    size              input                output
    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 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   13 conv    256  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 256  0.089 BFLOPs
   14 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   15 conv    255  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 255  0.044 BFLOPs
   16 yolo
   17 route  13
   18 conv    128  1 x 1 / 1    13 x  13 x 256   ->    13 x  13 x 128  0.011 BFLOPs
   19 upsample            2x    13 x  13 x 128   ->    26 x  26 x 128
   20 route  19 8
   21 conv    256  3 x 3 / 1    26 x  26 x 384   ->    26 x  26 x 256  1.196 BFLOPs
   22 conv    255  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 255  0.088 BFLOPs
   23 yolo
Loading weights from ./yolov3-tiny.weights...Done!
./data/dog.jpg: Predicted in 0.003906 seconds.
dog: 57%
car: 52%
truck: 56%
car: 62%
bicycle: 59%
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$

Tiny YOLOv3 - training

How to train yolov3-tiny (to detect your custom objects):

  • Download default weights file for yolov3-tiny:
    https://pjreddie.com/media/files/yolov3-tiny.weights
  • Get pre-trained weights yolov3-tiny.conv.15 using command:
darknet.exe partial cfg/yolov3-tiny.cfg yolov3-tiny.weights yolov3-tiny.conv.15 15

./darknet partial ./cfg/yolov3-tiny.cfg ./yolov3-tiny.weights ./yolov3-tiny.conv.15 15
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$ ./darknet partial ./cfg/yolov3-tiny.cfg ./yolov3-tiny.weights ./yolov3-tiny.conv.15 15
layer     filters    size              input                output
    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 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   13 conv    256  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 256  0.089 BFLOPs
   14 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   15 conv    255  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 255  0.044 BFLOPs
   16 yolo
   17 route  13
   18 conv    128  1 x 1 / 1    13 x  13 x 256   ->    13 x  13 x 128  0.011 BFLOPs
   19 upsample            2x    13 x  13 x 128   ->    26 x  26 x 128
   20 route  19 8
   21 conv    256  3 x 3 / 1    26 x  26 x 384   ->    26 x  26 x 256  1.196 BFLOPs
   22 conv    255  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 255  0.088 BFLOPs
   23 yolo
Loading weights from ./yolov3-tiny.weights...Done!
Saving weights to ./yolov3-tiny.conv.15
yongqiang@server-sys:~/darknet_work/darknet_181018/darknet$
  • Make your custom model yolov3-tiny-obj.cfg based on cfg/yolov3-tiny_obj.cfg instead of yolov3.cfg
  • Start training:
darknet.exe detector train data/obj.data yolov3-tiny-obj.cfg yolov3-tiny.conv.15
./darknet detector train ./train_cfg/yolov3_tiny_101.data ./train_cfg/yolov3_tiny_101.cfg ./yolov3-tiny.conv.15 -gpus 0,1,2,3 2> yolov3_tiny_101_stderr_v0.txt | tee yolov3_tiny_101_stdout_v0.txt

你可能感兴趣的:(Darknet,-,old)