当前位置:网站首页>Structure and usage of transform
Structure and usage of transform
2022-06-23 08:06:00 【booze-J】
List of articles
One 、transform effect
chart 1

chart 2

Two 、 The practical application tensor type
The detailed code is as follows :
from torch.utils.tensorboard import SummaryWriter
from torchvision import transforms
from PIL import Image
# python Usage of -》 tensor data type
# adopt transform.ToTensor Look at two questions
# 2、 Why do we need Tensor data type : because tensor The type data contains the attributes needed to train the neural network
image_path = r"D:\pycharm_professional\PycharmProjects\learning_pytorch\dataset\train\ants_image\0013035.jpg"
img = Image.open(image_path)
writer = SummaryWriter("logs") # ctrl+P View parameters ctrl + alt Solve the problem of red explosion
# 1、transforms How to use (python)
# Generate an object
tensor_trans = transforms.ToTensor()
tensor_img = tensor_trans(img)
# Use tensorboard Exhibition
writer.add_image("tensor_img",tensor_img,1)
writer.close()
terminal Terminal input instructions tensorboard --logdir="logs" --port=6007
give the result as follows :
边栏推荐
猜你喜欢

On ThreadLocal and inheritablethreadlocal, source code analysis

imperva-查找正则匹配超时的方法

INT 104_LEC 06

Introduction to Excel VBA and practical examples

套接字socket编程

浅谈ThreadLocal和InheritableThreadLocal,源码解析

Socket socket programming

php序列化和反序列化-ctf

Rotary table visual screening machine and its image recognition system

VTK. Le bouton gauche de la souris JS glisse pour changer le niveau et la largeur de la fenêtre
随机推荐
Unity audio visualization scheme
Quickly delete the node in the code_ modules
firewalld 配置文件的位置
Start appium
Socket programming (multi process)
GTEST死亡测试
Regular expression use cases
【Try to Hack】ip地址
vtk.js鼠標左鍵滑動改變窗比特和窗寬
Mathematical knowledge: fast power fast power
C# 内存法复制图像bitmap
开源软件、自由软件、Copyleft、CC都是啥,傻傻分不清楚?
Location of firewalld configuration file
Match 56 de la semaine d'acwing [terminé]
MFC Radio Button分组
通过端口查文件
Introduction to Excel VBA and practical examples
C restart application
QT project error: -1: error: cannot run compiler 'clang++' Output:mingw32-make. exe
黄蓉真的存在吗?