[论文复现] 使用fluid.layers.random_crop 函数处理图像有错误
Created by: Costwen
`
def totensor(imgs, type):
imgs = fluid.dygraph.to_variable(imgs)
imgs = imgs / 255.
imgs = fluid.layers.transpose(imgs, (0,3,1,2))
if type == 'A':
imgs = fluid.layers.image_resize(imgs, (256+30,256+30))
imgs = fluid.layers.random_crop(imgs, (256,256))
imgs = (imgs - 0.5) / 0.5
else :
imgs = fluid.layers.image_resize(imgs, (256,256))
imgs = (imgs - 0.5) / 0.5
return imgs
` 这是我写的裁剪的代码