PaddleDetection对自己训练的yolov3_mobilenet_v1模型进行剪枝报错
Created by: kim3352
目前,我根据文档使用这段代码查看模型参数:
python3 slim_prune_prune.py
-c ./configs/yolov3_mobilenet_v1_pig.yml
--print_params
输出:
...
parameter name: yolo_block.0.0.0.conv.weights shape: (512, 1024, 1, 1)
parameter name: yolo_block.0.0.0.bn.scale shape: (512,)
parameter name: yolo_block.0.0.0.bn.offset shape: (512,)
parameter name: yolo_block.0.0.0.bn.mean shape: (512,)
...
执行这段代码进行裁剪:
python3 slim_prune_prune.py
-c ./configs/yolov3_mobilenet_v1_pig.yml
--pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights"
--pruned_ratios="0.2,0.3,0.4"
裁剪完,执行下面这段代码进行验证:
python3 slim_prune_eval.py
-c ./configs/yolov3_mobilenet_v1_pig.yml
--pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights"
--pruned_ratios="0.2,0.3,0.4"
-o weights=output/yolov3_mobilenet_v1_pig/best_model
报如下错误:
AssertionError: Shape not matching: the Program requires a parameter with a shape of ((512,)), while the loaded parameter (namely [ yolo_block.0.0.0.bn.mean ]) has a shape of ((410,)).