Once the ana
command has executed successfully, you can start
pruning the model. prune
is very similar to ana
and
uses the same configuration file:
./vai_p_darknet pruner prune pruning/cfg pruning/yolov3-voc_final.weights
The pruning tool prunes the model according to the value of threshold and generates an output as follows. After loading the model, the tool shows the pruning rate for each layer and the output weights file. Finally, it automatically evaluates the mAP of the pruned model. You can see that the mAP after pruning is 0.494531, much lower than the original one. Finetuning, which is the next step, is used to recover the accuracy. If you want to follow the iterative pruning with a small step size, change the threshold option in the main cfg to a smaller value and run again.
Start pruning ...
pruning slot: 0,
prune main layer 0
kernel_batch:2, rate:0.3000, keep_num:24
pruning slot: 1,3,
prune main layer 1
kernel_batch:2, rate:0.3000, keep_num:46
prune slave layer 3
prune related layer 2
kernel_batch:2, rate:0.3000, keep_num:24
...
pruning slot: 102,
prune main layer 102
kernel_batch:2, rate:0.5000, keep_num:128
prune related layer 101
kernel_batch:2, rate:0.5000, keep_num:64
Saving weights to pruning/weights.prune
calculate map
Process 100 on GPU 0
Process 200 on GPU 0
...
Process 4800 on GPU 0
Process 4900 on GPU 0
AP for class 0 = 0.501017
AP for class 1 = 0.711958
...
AP for class 18 = 0.621339
AP for class 19 = 0.472648
mAP : 0.494531
Total Detection Time: 158.943884 Seconds