赞
踩
经过排查后发现是torchvision.transoforms.Resize的问题,Resize注释如下,如果传进单个数字size
,只会令最小的边resize成传入的数字。如图片height > width
,然后图片会被resize为(size * height / width, size)
,当batch_size>1
时可能会抛异常
class Resize(builtins.object)
| Resize(size, interpolation=2)
|
| Resize the input PIL Image to the given size.
|
| Args:
| size (sequence or int): Desired output size. If size is a sequence like
| (h, w), output size will be matched to this. If size is an int,
| smaller edge of the image will be matched to this number.
| i.e, if height > width, then image will be rescaled to
| (size * height / width, size)
| interpolation (int, optional): Desired interpolation. Default is
| ``PIL.Image.BILINEAR``
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。