pytorch之Resize()函数Resize函数⽤于对PIL图像的预处理,它的包在:
ansforms import Compose, CenterCrop, ToTensor, Resize
resize函数vba
使⽤如:
def input_transform(crop_size, upscale_factor):
return Compose([
CenterCrop(crop_size),
Resize(crop_size // upscale_factor),
ToTensor(),
])
⽽Resize函数有两个参数,
ansforms.Resize(size, interpolation=2)
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
size : 获取输出图像的⼤⼩
interpolation : 插值,默认的  PIL.Image.BILINEAR,⼀共有4中的插值⽅法
Image.BICUBIC,PIL.Image.LANCZOS,PIL.Image.BILINEAR,PIL.Image.NEAREST

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。