pytorch之Resize()函数具体使用详解


Posted in Python onFebruary 27, 2020

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() 内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Python 相关文章推荐
Python中map,reduce,filter和sorted函数的使用方法
Aug 17 Python
Python中查看文件名和文件路径
Mar 31 Python
Python中scatter函数参数及用法详解
Nov 08 Python
Python安装Flask环境及简单应用示例
May 03 Python
Python学习笔记之抓取某只基金历史净值数据实战案例
Jun 03 Python
python连接PostgreSQL数据库的过程详解
Sep 18 Python
在python shell中运行python文件的实现
Dec 21 Python
Win系统PyQt5安装和使用教程
Dec 25 Python
Tensorflow 自定义loss的情况下初始化部分变量方式
Jan 06 Python
python标准库OS模块详解
Mar 10 Python
Python中remove漏删和索引越界问题的解决
Mar 18 Python
关于Python错误重试方法总结
Jan 03 Python
浅谈Python中的异常和JSON读写数据的实现
Feb 27 #Python
简单了解Python write writelines区别
Feb 27 #Python
python json load json 数据后出现乱序的解决方案
Feb 27 #Python
Python3标准库之functools管理函数的工具详解
Feb 27 #Python
Python打包工具PyInstaller的安装与pycharm配置支持PyInstaller详细方法
Feb 27 #Python
python通过对字典的排序,对json字段进行排序的实例
Feb 27 #Python
python实现翻译word表格小程序
Feb 27 #Python
You might like
PHP 正则表达式之正则处理函数小结(preg_match,preg_match_all,preg_replace,preg_split)
2012/10/05 PHP
WordPress的主题编写中获取头部模板和底部模板
2015/12/28 PHP
php常用的工具开发整理
2019/09/26 PHP
PHP7 新增常量
2021/03/09 PHP
javascript与webservice的通信实现代码
2010/12/25 Javascript
JS代码放在head和body中的区别分析
2011/12/01 Javascript
简约JS日历控件 实例代码
2013/07/12 Javascript
使用js实现雪花飘落效果
2013/08/26 Javascript
防止jQuery ajax Load使用缓存的方法小结
2014/02/22 Javascript
关于javaScript注册click事件传递参数的不成功问题
2014/07/18 Javascript
详解JavaScript中shift()方法的使用
2015/06/09 Javascript
jquery+ajax实现直接提交表单实例分析
2016/06/17 Javascript
Javascript+CSS3实现进度条效果
2016/10/28 Javascript
jQuery插件HighCharts绘制简单2D折线图效果示例【附demo源码】
2017/03/21 jQuery
JavaScript实现简单的隐藏式侧边栏功能示例
2018/08/31 Javascript
详解Vue.js v-for不支持IE9的解决方法
2018/12/29 Javascript
Vue.js 无限滚动列表性能优化方案
2019/12/02 Javascript
使用 Opentype.js 生成字体子集的实例代码详解
2020/05/25 Javascript
vue 微信分享回调iOS和安卓回调出现错误的解决
2020/09/07 Javascript
JavaScript实现点击切换验证码及校验
2021/01/10 Javascript
Centos5.x下升级python到python2.7版本教程
2015/02/14 Python
Python实现文件复制删除
2016/04/19 Python
Python with语句上下文管理器两种实现方法分析
2018/02/09 Python
详解Python 正则表达式模块
2018/11/05 Python
基于pytorch 预训练的词向量用法详解
2020/01/06 Python
Android本地应用打开方法——通过html5写连接
2016/03/11 HTML / CSS
PHP数据运算类型都有哪些
2013/11/05 面试题
总裁办公室主任职责
2014/01/02 职场文书
采购部经理岗位职责
2014/02/10 职场文书
四议两公开实施方案
2014/03/28 职场文书
副总经理党的群众路线教育实践活动个人对照检查材料思想汇报
2014/10/06 职场文书
教师思想工作总结2015
2015/05/13 职场文书
永不妥协观后感
2015/06/10 职场文书
2016年第32个教师节红领巾广播稿
2015/12/18 职场文书
解析CSS 提取图片主题色功能(小技巧)
2021/05/12 HTML / CSS
Python使用BeautifulSoup4修改网页内容
2022/05/20 Python