当前位置:网站首页>[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]
边栏推荐
- Zzuli:1053 sine function
- Pytoch deep learning and target detection practice notes
- Yolov5 series (I) -- network visualization tool netron
- NOI OPENJUDGE 1.6(09)
- Déformation de la chaîne bm83 de niuke (conversion de cas, inversion de chaîne, remplacement de chaîne)
- Zzuli:1052 sum of sequence 4
- Unity hierarchical bounding box AABB tree
- 什么是Label encoding?one-hot encoding ,label encoding两种编码该如何区分和使用?
- dllexport和dllimport
- 从书本《皮囊》摘录的几个句子
猜你喜欢

On MEM series functions of C language

Composite type (custom type)

Implement Gobang with C language

Remote server background hangs nohup

Influxdb2 sources add data sources
![[ue4] geometry drawing pipeline](/img/30/9fcf83a665043fe57389d44c2e16a8.jpg)
[ue4] geometry drawing pipeline
![[ue4] HISM large scale vegetation rendering solution](/img/a2/2ff2462207e3c3e8364a092765040c.jpg)
[ue4] HISM large scale vegetation rendering solution

Introduction to opengl4.0 tutorial computing shaders

Troubleshooting method of CPU surge

Vs+qt multithreading implementation -- run and movetothread
随机推荐
Tencent internship interview sorting
Unity hierarchical bounding box AABB tree
牛客 BM83 字符串變形(大小寫轉換,字符串反轉,字符串替換)
Amazon, express, lazada, shopee, eBay, wish, Wal Mart, Alibaba international, meikeduo and other cross-border e-commerce platforms evaluate how Ziyang account can seize traffic by using products in th
Besides lying flat, what else can a 27 year old do in life?
Zzuli:1047 logarithmic table
406. Reconstruct the queue according to height
Vs+qt application development, set software icon icon
Global and Chinese market of transfer case 2022-2028: Research Report on technology, participants, trends, market size and share
TPS61170QDRVRQ1
Global and Chinese market of postal automation systems 2022-2028: Research Report on technology, participants, trends, market size and share
Influxdb2 sources add data sources
Zzuli:1040 sum of sequence 1
Zzuli:1048 factorial table
Global and Chinese market of iron free motors 2022-2028: Research Report on technology, participants, trends, market size and share
[engine development] in depth GPU and rendering optimization (basic)
4-33--4-35
C # realizes the login interface, and the password asterisk is displayed (hide the input password)
4-20-4-23 concurrent server, TCP state transition;
[graphics] adaptive shadow map