pp-yolo 剪枝参数选择问题
Created by: Fauny
模型:ppyolo 训练结果:Best test box ap: 0.7949662589940378 'loss': '26.862640' , 导出模型大小:188.1M。经测试模型比较满意 敏感度分析:获得敏感度分析文件 确定参数:使用一下代码获得
import math
from paddleslim.prune import load_sensitivities
from paddleslim.prune import get_ratios_by_loss
sensitivities_file = "sstv.data"
sensitivities = load_sensitivities(sensitivities_file)
# print(sensitivities)
ratios = get_ratios_by_loss(sensitivities, 0.1)
print(ratios)
获得参数:
{
'yolo_block.0.0.0.conv.weights': 0.5024404642823515,
'yolo_block.0.0.1.conv.weights': 0.5806873814522566,
// 'yolo_block.0.1.0.conv.weights': 0.4130713279785401,
'yolo_block.0.1.1.conv.weights': 0.8445627084858831,
'yolo_block.0.2.conv.weights': 0.7140574970525724,
'yolo_block.0.tip.conv.weights': 0.8026657765827588,
'yolo_block.1.0.0.conv.weights': 0.9,
'yolo_block.1.0.1.conv.weights': 0.8590961280425866,
'yolo_block.1.1.0.conv.weights': 0.7435697192868094,
'yolo_block.1.1.1.conv.weights': 0.8933719407087457,
'yolo_block.1.2.conv.weights': 0.796605418059164,
'yolo_block.1.tip.conv.weights': 0.9,
'yolo_block.2.0.0.conv.weights': 0.8641740135486591,
'yolo_block.2.0.1.conv.weights': 0.7584828344125396,
'yolo_block.2.1.0.conv.weights': 0.7780280316817834,
'yolo_block.2.1.1.conv.weights': 0.8247591955828633,
'yolo_block.2.2.conv.weights': 0.7763518811427775,
'yolo_block.2.tip.conv.weights': 0.8543156017782207
}
参考 #1346 (closed), 去掉 yolo_block.0.1.0.conv.weights 最终参数:
--pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.1.conv.weights,yolo_block.0.2.conv.weights,yolo_block.0.tip.conv.weights,yolo_block.1.0.0.conv.weights,yolo_block.1.0.1.conv.weights,yolo_block.1.1.0.conv.weights,yolo_block.1.1.1.conv.weights,yolo_block.1.2.conv.weights,yolo_block.1.tip.conv.weights,yolo_block.2.0.0.conv.weights,yolo_block.2.0.1.conv.weights,yolo_block.2.1.0.conv.weights,yolo_block.2.1.1.conv.weights,yolo_block.2.2.conv.weights,yolo_block.2.tip.conv.weights" \
--pruned_ratios="0.5,0.5,0.8,0.7,0.8,0.9,0.8,0.7,0.8,0.7,0.9,0.8,0.7,0.7,0.8,0.7,0.8" \
问题来了,训练中途,在box ap:0.7086416361742713 时测试,发现结果很不正常,与剪枝前结果大相径庭。 请教原因:
- get_ratios_by_loss 使用 0.1 参数是不是太大?
- 使用参数中,除了yolo_block.0.1.0.conv.weights ,还有别的不能剪的吗?