pp-yolo剪枝的时候报通道错误
Created by: thunder95
对已训练好的的模型进行剪枝,但是报错了卷积核通道数量不匹配的问题
python prune.py -c ../../myconfigs/my_ppyolo.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"
Python Call Stacks (More useful to users):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2798, in append_op attrs=kwargs.get("attrs", None)) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/nn.py", line 1581, in conv2d "data_format": data_format, File "/home/aistudio/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 166, in _conv_bn bias_attr=False) File "/home/aistudio/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 241, in _detection_block name='{}.{}.spp.conv'.format(name, j)) File "/home/aistudio/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 335, in _get_outputs name=self.prefix_name + "yolo_block.{}".format(i)) File "/home/aistudio/PaddleDetection/ppdet/modeling/anchor_heads/yolo_head.py", line 389, in get_loss outputs = self._get_outputs(input, is_train=True) File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 85, in build gt_score, targets) File "/home/aistudio/PaddleDetection/ppdet/modeling/architectures/yolo.py", line 159, in train return self.build(feed_vars, mode='train') File "prune.py", line 100, in main train_fetches = model.train(feed_vars) File "prune.py", line 412, in main()
Error Message Summary:
InvalidArgumentError: The number of input's channels should be equal to filter's channels * groups for Op(Conv). But received: the input's channels is 1228, the input's shape is [32, 1228, 13, 13]; the filter's channels is 1843, the filter's shape is [512, 1843, 1, 1]; the groups is 1, the data_format is NCHW. The error may come from wrong data_format setting. [Hint: Expected input_channels == filter_dims[1] * groups, but received input_channels:1228 != filter_dims[1] * groups:1843.] at (/paddle/paddle/fluid/operators/conv_op.cc:94) [operator < conv2d > error]