PaddleDetection剪枝的基础上再量化该怎么做
Created by: TianyouChen
我想用剪枝出来的模型进行量化,发现参数加载不匹配,网络加载原始yolov3,但是参数加载剪枝后的,这个该怎么配置修改让参数匹配并能量化训练? 详细信息如下: 训练指令:
python3 slim/quantization/train.py --not_quant_pattern slim_output \
--eval --c ./configs/yolov3_mobilenet_v1_Headshoulder.yml -o max_iters=30000 \
save_dir=./output/prune_quant_yolov3 LearningRate.base_lr=0.0001 LearningRate.schedulers="[!PiecewiseDecay {gamma: 0.1, milestones: [10000]}]" pretrain_weights=output/prue_Headshoulder/yolov3_mobilenet_v1_Headshoulder/best_model
报错信息:
2020-03-30 09:53:24,269-INFO: 1690 samples in file dataset/voc/test.txt
2020-03-30 09:53:24,270-INFO: places would be ommited when DataLoader is not iterable
W0330 09:53:25.296880 6945 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 10.1, Runtime API Version: 9.0
W0330 09:53:25.300591 6945 device_context.cc:245] device: 0, cuDNN Version: 7.6.
2020-03-30 09:53:28,249-INFO: Loading parameters from output/prue_Headshoulder/yolov3_mobilenet_v1_Headshoulder/best_model...
Traceback (most recent call last):
File "slim/quantization/train.py", line 314, in <module>
main()
File "slim/quantization/train.py", line 193, in main
ignore_params=ignore_params)
File "/home/chenchaocun/PaddleDetection_3.27/ppdet/utils/checkpoint.py", line 142, in load_params
fluid.io.set_program_state(prog, state)
File "/usr/local/lib/python3.5/dist-packages/paddle/fluid/io.py", line 1942, in set_program_state
.format(orig_para_np.shape, para.name, new_para_np.shape)
AssertionError: Shape not matching: the Program requires a parameter with a shape of ((512, 1024, 1, 1)), while the loaded parameter (namely [ yolo_block.0.0.0.conv.weights ]) has a shape of ((51, 1024, 1, 1)).
多谢指教~