当前位置:网站首页>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 :
边栏推荐
- Unity to wechat applet games
- 忽略超长参数违规
- Matlab random volatility SV, GARCH using MCMC Markov chain Monte Carlo method to analyze exchange rate time series
- Pseudocode specification, pseudocode online editor,
- odoo项目 发送信息到微信公众号或企业微信的做法
- 转盘式视觉筛选机及其图像识别系统
- [veusz] import 2D data in CSV
- VTK. Le bouton gauche de la souris JS glisse pour changer le niveau et la largeur de la fenêtre
- On ThreadLocal and inheritablethreadlocal, source code analysis
- [kubernetes] download address of the latest version of each major version of kubernetes
猜你喜欢

vtk.js鼠标左键滑动改变窗位和窗宽

qt 不规则图形 消除锯齿

Ignore overlength parameter violation
![Acwing game 56 [End]](/img/f6/cd650331c819a27f17c9ce6cd0c569.png)
Acwing game 56 [End]

聊聊服务治理中的路由设计
![[try to hack] IP address](/img/ab/ed91f3094ac913a0d79448a2d19015.png)
[try to hack] IP address

Rotary table visual screening machine and its image recognition system

1278_ FreeRTOS_ Understand the delayed task with the prvaddcurrenttasktodelayedlist interface

浅谈ThreadLocal和InheritableThreadLocal,源码解析

PHP 文件包含 -ctf
随机推荐
How do I install MySQL on my computer?
transform的结构及用法
11 字符串函数
vtk.js鼠标左键滑动改变窗位和窗宽
ArcMap批量删除距离较近的点
MIT CMS.300 Session 12 – IDENTITY CONSTRUCTION 虚拟世界中身份认同的建立 part 2
aquatone工具 中的2個bug修複
Apache Solr 任意文件读取复现
爬虫框架
Huawei ECS EIP cannot be pinged
深度学习------不同方法实现vgg16
记一次高校学生账户的“从无到有”
VTK. Le bouton gauche de la souris JS glisse pour changer le niveau et la largeur de la fenêtre
Create an orderly sequence table and perform the following operations: 1 Insert element x into the table and keep it in order; 2. find the element with the value of X, and delete it if found; 3. outpu
socket编程(多线程)
A record of "from scratch" in college student accounts
On ThreadLocal and inheritablethreadlocal, source code analysis
odoo项目 发送信息到微信公众号或企业微信的做法
MIT CMS. 300 session 12 – identity construction Part 2
PHP 文件包含 -ctf