当前位置:网站首页>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
最深刻 的故事 最永恒 的传说
不过 是你 是我 能够 平凡生活
——————五月天(因为你 所以我)——————
边栏推荐
- Loop filtering based on Unet
- slf4j 简单实现
- Coinbase in a bear market: losses, layoffs, stock price plunges
- Maixll-Dock 快速上手
- Maixll-Dock 使用方法
- 2022危险化学品生产单位安全生产管理人员题库及答案
- NFT: start NFT royalty journey with eip-2981
- Odeint and GPU
- Software testing needs more and more talents. Why do you still not want to take this path?
- Browser top loading (from Zhihu)
猜你喜欢

Recommend the best product development process in the Internet industry!

CF1638E. Colorful operations Kodori tree + differential tree array

LM小型可编程控制器软件(基于CoDeSys)笔记十九:报错does not match the profile of the target

VR线上展览所具备应用及特色

Maixll dock quick start
[today in history] June 30: von Neumann published the first draft; The semiconductor war in the late 1990s; CBS acquires CNET

尺取法:有效三角形的个数

Embedded System Development Notes 79: why should I get the IP address of the local network card

In the innovation community, the "100 cities Tour" of the gold warehouse of the National People's Congress of 2022 was launched

LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver
随机推荐
Note de développement du système embarqué 80: application du concepteur Qt à la conception de l'interface principale
JMeter learning notes 2 - brief introduction to graphical interface
Learn Chapter 20 of vue3 (keep alive cache component)
[difficult] sqlserver2008r2, can you recover only some files when recovering the database?
[learn C and fly] S1E20: two dimensional array
Redis (VII) optimization suggestions
2022年上海市安全员C证考试题模拟考试题库及答案
Seven crimes of counting software R & D Efficiency
Ospfb notes - five messages [ultra detailed] [Hello message, DD message, LSR message, LSU message, lsack message]
Measurement of quadrature axis and direct axis inductance of three-phase permanent magnet synchronous motor
2022 hoisting machinery command registration examination and hoisting machinery command examination registration
做网站数据采集,怎么选择合适的服务器呢?
网站服务器:好用的网站服务器怎么选这五方面要关注
Haskell lightweight threads overhead and use on multicores
尺取法:有效三角形的个数
Software testing needs more and more talents. Why do you still not want to take this path?
Difference between cookie and session
Use winmtr software to simply analyze, track and detect network routing
【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码
Collect the annual summary of laws, regulations, policies and plans related to trusted computing of large market points (national, ministerial, provincial and municipal)