当前位置:网站首页>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
最深刻 的故事 最永恒 的传说
不过 是你 是我 能够 平凡生活
——————五月天(因为你 所以我)——————
边栏推荐
- 一些小知识点
- Concurrent mode of different performance testing tools
- 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
- 【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码
- Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services
- VIM简易使用教程
- Loop filtering based on Unet
- Valid @suppresswarnings warning name
- 如何看待智慧城市建设中的改变和机遇?
- Coinbase in a bear market: losses, layoffs, stock price plunges
猜你喜欢

js 图片路径转换base64格式

2022 gas examination question bank and online simulation examination

嵌入式系统开发笔记79:为什么要获取本机网卡IP地址

Ten wastes of software research and development: the other side of research and development efficiency

Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services

206. reverse linked list

Internet winter, how to spend three months to make a comeback

Strategic suggestions and future development trend of global and Chinese vibration isolator market investment report 2022 Edition

测量三相永磁同步电机的交轴直轴电感

2022年G1工业锅炉司炉特种作业证考试题库及在线模拟考试
随机推荐
OSPF notes [multiple access, two multicast addresses with OSPF]
JVM栈和堆简介
How do I sort a list of strings in dart- How can I sort a list of strings in Dart?
TASK04|数理统计
selenium打开chrome浏览器时弹出设置页面:Mircrosoft Defender 防病毒要重置您的设置
Why is Hong Kong server most suitable for overseas website construction
软件研发的十大浪费:研发效能的另一面
Codeworks round 449 (Div. 1) C. Kodori tree template
2022年煤气考试题库及在线模拟考试
Dual contractual learning: text classification via label aware data augmentation reading notes
2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank
283. move zero
2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination
LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver
Advanced application of ES6 modular and asynchronous programming
LM small programmable controller software (based on CoDeSys) note 19: errors do not match the profile of the target
Applications and features of VR online exhibition
About the transmission pipeline of stage in spark
[send email with error] 535 error:authentication failed
Shell之分析服务器日志命令集锦