Open bigbai0210 opened 4 years ago
补丁已经打上了,需要改动analysis/CaffeA.py,具体如下:
将源代码中的:
if layer.type == 'Convolution': param = layer.convolution_param out = Conv(blob_dict[layer.bottom[0]], param.kernel_size, param.num_output, param.stride, param.pad, None, layer.name, group_size=param.group)
替换为:
if layer.type in ['Convolution', 'Deconvolution']: param = layer.convolution_param out = Conv(blob_dict[layer.bottom[0]], param.kernel_size, param.num_output, param.stride, param.pad, None, layer.name, group_size=param.group, transpose=layer.type == 'Deconvolution')
即可
this repor already contains Deconv type
def _conv_transpose2d(raw,input, weight, bias=None, stride=1, padding=0, output_padding=0, groups=1, dilation=1):
x=raw(input, weight, bias, stride, padding, output_padding, groups, dilation)
name=log.add_layer(name='conv_transpose')
log.add_blobs([x],name='conv_transpose_blob')
layer=caffe_net.Layer_param(name=name, type='Deconvolution',
bottom=[log.blobs(input)], top=[log.blobs(x)])
layer.conv_param(x.size()[1],weight.size()[2:],stride=_pair(stride),
pad=_pair(padding),dilation=_pair(dilation),bias_term=bias is not None, groups = groups)
if bias is not None:
layer.add_data(weight.cpu().data.numpy(),bias.cpu().data.numpy())
else:
layer.param.convolution_param.bias_term=False
layer.add_data(weight.cpu().data.numpy())
log.cnet.add_layer(layer)
return x
analysis.layers中不包含Deconv这一类,这个补丁如何打呢?