将Learning Efficient Convolutional Networks Through Network Slimming (ICCV 2017)应用在yolov3和yolov2上
pytorch 0.41
window 10
1.对原始weights文件进行稀疏化训练
python sparsity_train.py -sr --s 0.0001 --image_folder coco.data --cfg yolov3.cfg --weights yolov3.weights
2.剪枝
python prune.py --cfg yolov3.cfg --weights checkpoints/yolov3_sparsity_100.weights --percent 0.3
3.对剪枝后的weights进行微调
python sparsity_train.py --image_folder coco.data --cfg prune_yolov3.cfg --weights prune_yolov3.weights
new_prune更新了算法,现在可以确保不会有某一层被减为0的情况发生,参考RETHINKING THE SMALLER-NORM-LESSINFORMATIVE ASSUMPTION IN CHANNEL PRUNING OF CONVOLUTION LAYERS(ICLR 2018)对剪枝后bn层β系数进行了保留
coco测试