当前位置:网站首页>[pytorch learning notes] transforms
[pytorch learning notes] transforms
2022-07-03 15:00:00 【liiiiiiiiiiiiike】
Transforms
all torchvision Data sets have two parameters transform and target_transform, The former enhances the image , The latter deals with labels ( Label smoothing ).Fashionmnist yes PIL Image format , The label is an integer . For training , It is necessary to convert the features into normalized tensor, And label one-hot Coding is convenient softmax. have access to ToTensor and Lambda.
import torch
from torchvision import datasets
from torchvision.transforms import ToTensor, Lambda
ds = datasets.FashionMNIST(
root="data",
train=True,
download=True,
transform=ToTensor(),
target_transform=Lambda(lambda y: torch.zeros(10, dtype=torch.float).scatter_(0, torch.tensor(y), value=1))
)
ToTensor()
ToTensor() take PIL Image or ndarray Convert to FloatTensor, And normalize the pixels to [0,1]
边栏推荐
- [ue4] geometry drawing pipeline
- High quality workplace human beings must use software to recommend, and you certainly don't know the last one
- Zzuli:1047 logarithmic table
- Zzuli:1042 sum of sequence 3
- Bucket sorting in C language
- Global and Chinese market of postal automation systems 2022-2028: Research Report on technology, participants, trends, market size and share
- Pytorch深度学习和目标检测实战笔记
- Zzuli:1058 solving inequalities
- 5-1 blocking / non blocking, synchronous / asynchronous
- CentOS7部署哨兵Redis(带架构图,清晰易懂)
猜你喜欢
Zero copy underlying analysis
Besides lying flat, what else can a 27 year old do in life?
Introduction to opengl4.0 tutorial computing shaders
[graphics] real shading in Unreal Engine 4
5.2-5.3
Incluxdb2 buckets create database
Devaxpress: range selection control rangecontrol uses
[ue4] cascading shadow CSM
dllexport和dllimport
Byte practice plane longitude 2
随机推荐
Leetcode the smallest number of the rotation array of the offer of the sword (11)
Zzuli:1048 factorial table
Zzuli:1054 monkeys eat peaches
CentOS7部署哨兵Redis(带架构图,清晰易懂)
Yolov5系列(一)——網絡可視化工具netron
7-1 positive integer a+b (15 points)
[combinatorics] permutation and combination (set combination, one-to-one correspondence model analysis example)
Zzuli:1059 highest score
Zzuli:1040 sum of sequence 1
Pytoch deep learning and target detection practice notes
Neon global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
Use of form text box (I) select text
4-24--4-28
1017 a divided by B (20 points)
5-1 blocking / non blocking, synchronous / asynchronous
The picture quality has been improved! LR enhancement details_ Lightroom turns on AI photo detail enhancement: picture clarity increases by 30%
Zzuli: cumulative sum of 1050 factorials
[ue4] geometry drawing pipeline
Center and drag linked global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
Zzuli:1046 product of odd numbers