pytorch之Resize()函数具体使用详解
2020-04-30 07:38
3323 查看
Resize函数用于对PIL图像的预处理,它的包在:
from torchvision.transforms import Compose, CenterCrop, ToTensor, Resize
使用如:
def input_transform(crop_size, upscale_factor): return Compose([ CenterCrop(crop_size), Resize(crop_size // upscale_factor), ToTensor(), ])
而Resize函数有两个参数,
CLASS torchvision.transforms.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
到此这篇关于pytorch之Resize()函数具体使用详解的文章就介绍到这了,更多相关pytorch Resize() 内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
您可能感兴趣的文章:
相关文章推荐
- Pytorch之finetune使用详解
- Pytorch使用MNIST数据集实现基础GAN和DCGAN详解
- 基于python及pytorch中乘法的使用详解
- numpy.linspace函数具体使用详解
- pytorch之ImageFolder使用详解
- Pytorch 多块GPU的使用详解
- Pytorch mask_select 函数的用法详解
- Pytorch之卷积层的使用详解
- django框架使用views.py的函数对表进行增删改查内容操作详解【models.py中表的创建、views.py中函数的使用,基于对象的跨表查询】
- Pytorch之view及view_as使用详解
- Win32 API 函数大全使用详解十 鼠标输入函数
- string基本的类成员函数的使用(at、length、size、begin、empty、resize)
- C#有关HashTable的具体使用用法详解
- SQL OBJECTPROPERTY 函数,使用详解
- c语言printf函数的使用详解
- Delphi中ShellExecute函数使用详解
- 互斥量、条件变量与pthread_cond_wait()函数的使用,详解
- PHP中strtotime函数使用方法详解
- C#中使用FindWindow函数详解 从标题获取句柄
- libcurl中curl_easy_setopt()和curl_easy_perform()函数使用中文详解