当前位置:网站首页>Pytorch(四) —— 可视化工具 Visdom
Pytorch(四) —— 可视化工具 Visdom
2022-07-01 04:35:00 【CyrusMay】
Pytorch(四) —— 可视化工具 Visdom
1.安装
pip install visdom
2 使用流程
2.1 开启visdom的web服务器
python -m visdom.server
2.2 可视化种类及相关参数
2.2.1 曲线可视化
from visdom import Visdom
vis = Visdom()
vis.line(Y=[[0,0]],
X=[0],
win="这是小窗口的title",
env="这是大窗口的title", # 默认为main
opts=dict(title="change_x_y",legend=["x","y"]) # 可以设置图形标题和title
) # 初始化曲线
vis.line([[Tensor.item()],
[Tensor.item()],
win="change_X",
update="append") # 追加曲线数据
from visdom import Visdom
import torch
from torch import nn
import torch.nn.functional as F
vis = Visdom()
vis.line(Y=[[0,0]],X=[0],win="change_X",env="main",opts=dict(title="change_x_y",legend=["x","y"]))
def f(x):
return x[0]**2 + x[1]**2
x = torch.tensor([100.,90.],requires_grad=True)
opt = torch.optim.Adam([x],lr = 0.1)
epochs = 1000
for i in range(epochs):
y = f(x)
opt.zero_grad()
y.backward()
opt.step()
vis.line([[x[0].item(),x[1].item()]],[i],win="change_X",update="append")
2.2.2 图片可视化
from visdom import Visdom
vis = Visdom()
vis.image(img=data.view(-1,1,28,28),
win="这是小窗口的title",
env="这是大窗口的title", # 默认为main
) # 初始化曲线
2.2.3 文字可视化
from visdom import Visdom
vis = Visdom()
vis.text(text=str(Tensor.cpu().numpy()),
win="这是小窗口的title",
env="这是大窗口的title", # 默认为main
) # 初始化曲线
from visdom import Visdom
import torch
from torch import nn
import torch.nn.functional as F
vis = Visdom()
label = torch.arange(100)
vis.text(str(label.cpu().numpy()),win="文字展示",env="main")
by CyrusMay 2022 06 29
最深刻 的故事 最永恒 的传说
不过 是你 是我 能够 平凡生活
——————五月天(因为你 所以我)——————
边栏推荐
- Qt development experience tips 226-230
- TCP server communication flow
- 细数软件研发效能的七宗罪
- 1. Mobile terminal touch screen event
- [human version] Web3 privacy game in the dark forest
- 做网站数据采集,怎么选择合适的服务器呢?
- JD intelligent customer service Yanxi intention system construction and intention recognition technology introduction
- Seven crimes of counting software R & D Efficiency
- Recommend the best product development process in the Internet industry!
- LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver
猜你喜欢
Odeint and GPU
扩展-Fragment
使用WinMTR软件简单分析跟踪检测网络路由情况
2022年煤气考试题库及在线模拟考试
It's settled! 2022 JD cloud summit of JD global technology Explorer conference see you in Beijing on July 13
2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination
One job hopping up 8K, three times in five years
2022.2.7-2.13 AI industry weekly (issue 84): family responsibilities
Maixll-Dock 使用方法
2022 t elevator repair new version test questions and t elevator repair simulation test question bank
随机推荐
TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 桥接器与交换机 / 3.4.2 多属性注册协议(Multiple Registration Protocol (MRP))
[Master / slave] router election in DD message
Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services
嵌入式系统开发笔记81:使用Dialog组件设计提示对话框
MySQL winter vacation self-study 2022 12 (5)
Codeforces Round #721 (Div. 2)B1. Palindrome Game (easy version)B2. Palindrome game (hard version)
Daily question - line 10
JS rotation chart
Caijing 365 stock internal reference | the first IPO of Beijing stock exchange; the subsidiary of the recommended securities firm for gambling and gambling, with a 40% discount
It's settled! 2022 JD cloud summit of JD global technology Explorer conference see you in Beijing on July 13
VIM简易使用教程
How do I sort a list of strings in dart- How can I sort a list of strings in Dart?
js 图片路径转换base64格式
[difficult] sqlserver2008r2, can you recover only some files when recovering the database?
Haskell lightweight threads overhead and use on multicores
Knowledge supplement: basic usage of redis based on docker
Leetcode learning - day 36
Odeint et GPU
2022.2.7-2.13 AI industry weekly (issue 84): family responsibilities
[human version] Web3 privacy game in the dark forest