当前位置:网站首页>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
最深刻 的故事 最永恒 的传说
不过 是你 是我 能够 平凡生活
——————五月天(因为你 所以我)——————
边栏推荐
- Tcp/ip explanation (version 2) notes / 3 link layer / 3.4 bridge and switch / 3.4.2 multiple registration protocol (MRP)
- 为什么香港服务器最适合海外建站使用
- Announcement on the list of Guangdong famous high-tech products to be selected in 2021
- Registration of P cylinder filling examination in 2022 and analysis of P cylinder filling
- VIM简易使用教程
- What is uid? What is auth? What is a verifier?
- JS rotation chart
- [learn C and fly] S1E20: two dimensional array
- Why is Hong Kong server most suitable for overseas website construction
- Common interview questions ①
猜你喜欢

LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver

2022年G1工业锅炉司炉特种作业证考试题库及在线模拟考试

Jenkins automatically cleans up construction history

Loop filtering based on Unet

283. move zero

VIM简易使用教程

One job hopping up 8K, three times in five years

Odeint et GPU

js 图片路径转换base64格式

Common thread methods and daemon threads
随机推荐
Task04 | statistiques mathématiques
总结全了,低代码还需要解决这4点问题
JS image path conversion Base64 format
Dual contractual learning: text classification via label aware data augmentation reading notes
什么是uid?什么是Auth?什么是验证器?
Offline installation of Wireshark 2.6.10
Obtain detailed ideas for ABCDEF questions of 2022 American Games
In the innovation community, the "100 cities Tour" of the gold warehouse of the National People's Congress of 2022 was launched
2022 t elevator repair new version test questions and t elevator repair simulation test question bank
The junior college students were angry for 32 days, four rounds of interviews, five hours of soul torture, and won Ali's offer with tears
离线安装wireshark2.6.10
Difference between cookie and session
1. Mobile terminal touch screen event
selenium打开chrome浏览器时弹出设置页面:Mircrosoft Defender 防病毒要重置您的设置
Learn Chapter 20 of vue3 (keep alive cache component)
Recommend the best product development process in the Internet industry!
Custom components in applets
Task04 mathematical statistics
Maixll-Dock 快速上手
Valid @suppresswarnings warning name