Starting Pruning Loop - 1.2 English

Vitis AI Optimizer User Guide (UG1333)

Document ID
UG1333
Release Date
2020-07-07
Version
1.2 English

Once the command ana has ended, you can start pruning the model. The command prune is very similar to command ana and uses the same config 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. It will output as follows. After loading the model, the tool shows the pruning rate for each layer and the output weights file. Finally, it will automatically evaluate the mAP of the pruned model. You can see that the mAP after pruning is 0.494531, much lower than the original one. So the next step is finetuning, which will recover the accuracy. If you want to follow the iterative pruning with a small step size, change option “threshold” in 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