当前位置:网站首页>Pytorch's transforms (numpy data type is converted to tensor, normalized and resized)
Pytorch's transforms (numpy data type is converted to tensor, normalized and resized)
2022-07-25 19:47:00 【helloworld_ Fly】
pytorch transform Common formats
from torchvision import transforms
tensor = transforms.Tensor() # Initialize object
#img_or_np by “PIL Image” perhaps "numpy.", That is, the object you want to transform
data = tensor(img_or_np)
trans_resize = transforms.Resize(512,512)
data = trans_resize(data)
# Next, the data data normalization , The calculation method is as follows :image=(image-mean)/std
''' among mean and std Pass respectively (0.5,0.5,0.5) and (0.5,0.5,0.5) Make a designation . The original 0-1 minimum value 0 Has become a (0-0.5)/0.5=-1, And the maximum 1 Has become a (1-0.5)/0.5=1. '''
trans_norm = transforms.Normalize([0.5,0.5,0.5],[0.5,0.5,0.5])
img_normal = trans_norm(data)
边栏推荐
- Gbase 8s UDR memory management_ 01_ mi_ alloc
- University of California | feasible confrontation robust reinforcement learning for unspecified environments
- Univariate function integration_ Partial integral method
- Basic practice of Blue Bridge Cup - shape retrieval of matrix (C language)
- Legal mix of collations for operation 'Union' (bug record)
- High number_ Chapter 3 learning experience and summary of multiple integral
- VMware virtual machine download, installation and use tutorial
- 从瞳代到“瞳代”再到品牌,暴利的美瞳的变与未变
- From Tong Dai to "Tong Dai" and then to brand, the beauty of sudden profits has changed and remained unchanged
- 什么是唯心主义
猜你喜欢

A high efficiency 0-delay 0-copy QT player scheme based on Hisilicon 3559

Shopping guide for high-end flagship projectors: dangbei X3 pro and dangbei F5 are more immersive!

Security Basics 4 - regular expressions

Network packet multi-layer transmission demonstration
![Interpretation of repartitioned network structure in repvgg network [with code]](/img/0b/a2f3b312899043c9d5b9c7d6b22261.png)
Interpretation of repartitioned network structure in repvgg network [with code]

tiktok手机网络环境怎么设置?tiktok怎么破播放量?
![Scala foundation [set 01]](/img/6b/0f5da7ea923ef3aa436d7af9c4425c.png)
Scala foundation [set 01]

Creative drop-down multi choice JS plug-in download

C# 合并集合

英诚医院内部网络规划与设计
随机推荐
what is qml in qt
国内常见php的CMS建站系统情况分析
伺服驱动器在机器人上的研究与应用
Kcon 2022 highlights and agenda revealed!
Skiing mobile H5 game source code download
Typeerror: 'STR' object is not callable error reason
Beihang and other "deep learning event extraction" literature review paper, 27 page PDF describes the current trend
阿姆利塔工程学院|用于情感分析的方面术语提取中优化采样的强化主动学习方法
数字信息化(先枚举假设,再看是否满足条件)(1089 狼人杀-简单版)
Univariate function integration_ Partial integral method
AAAI 2022 | GAN的结构有“指纹”吗?从伪造图像溯源生成网络结构
浅谈接口加密
微信小程序开发之网络数据请求
Ml programming skills:
高端旗舰投影仪选购指南:当贝X3 Pro、当贝F5观影更沉浸!
微信小程序开发之全局配置与页面配置
Day7: ordered binary tree (binary search tree)
C语言学习日记3——realloc函数
Wechat applet 10 - wechat template
Flutter tips: optimizing the buildcontext you use