- 版本、环境信息:
1)PaddlePaddle版本:请提供您的PaddlePaddle版本号1.6
2)CPU/GPU:如果您使用GPU训练,请提供GPU1060、CUDA10.0和cuDNN7.4版本号
3)系统型号:ubuntu18.04
4)Python3.6
5)显存信息6GB
def paddle_deformable_conv():
main = fluid.Program()
start = fluid.Program()
img=np.random.uniform(0.0,1.0,(4,6,8))
offset=np.random.uniform(size=[3*3*2*4,6,8])
c,h,w=img.shape
offset_shape=[3*3*2*4,h,w]
print('imgs',img,
'\noffset',offset)
with fluid.program_guard(main, start):
imgs = fluid.layers.data('imgs', img.shape, dtype='float32')
fluid.layers.Print(imgs,1,'imgs',100)
offsets=fluid.layers.data('offset',offset_shape)
fluid.layers.Print(offsets,1,'offset',100)
out=fluid.layers.deformable_conv(imgs,offsets,None,4,3,1,1,bias_attr=False,deformable_groups=4,modulated=False)
place = fluid.CUDAPlace(0)
exe = fluid.Executor(place)
exe.run(start)
out=exe.run(main,feed={'imgs':img[np.newaxis,:,:,:].astype('float32'),
'offset':offset[np.newaxis,:,:,:].astype('float32')},
fetch_list=[out.name])
print(out[0].shape,out[0])
paddle_deformable_conv()
输出全部都是0
(1, 4, 6, 8) [[[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]
[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]
[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]
[[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0.]]]]
2条答案
按热度按时间vktxenjb1#
@ResearchingDexter hi, 这里输出全为0的原因是deformable_conv的参数
im2col_step
默认值为64,在使用中要求输入数据的batch_size应可以被该值整除,这里feed数据的batch_size为1,所以会导致计算上的错误。建议把im2col_step
指定为1再试试https://www.paddlepaddle.org.cn/documentation/docs/zh/api_cn/layers_cn/deformable_conv_cn.html#deformable-conv
zpqajqem2#
果然,改成1就可以了....