pytorch 训练可视化

pytorch 训练可视化

  • [1.from torch.utils.tensorboard](#1.from torch.utils.tensorboard)

1.from torch.utils.tensorboard

python 复制代码
from torch.utils.tensorboard import SummaryWriter

在最新版本的pytorch中官方提供了tensorboard的api。以下是官方教程的链接

text 复制代码
https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html?highlight=tensorboard

##1. TensorBoard setup

python 复制代码
from torch.utils.tensorboard import SummaryWriter
# default `log_dir` is "runs" - we'll be more specific here
writer = SummaryWriter('runs/fashion_mnist_experiment_1') # 创建一个保存日志的目录

##2. Writing to TensorBoard

在TensorBoard上显示图片,这里使用网格来显示。使用 make_grid 方法

python 复制代码
# 获取随机的训练图片
dataiter = iter(trainloader)
images, labels = dataiter.next()

# 构造网格布局的图片
img_grid = torchvision.utils.make_grid(images)

# 显示图片
matplotlib_imshow(img_grid, one_channel=True)

# 写入tensorboard
writer.add_image('four_fashion_mnist_images', img_grid)

在终端运行

shell 复制代码
tensorboard --logdir=runs

#已知问题及可能解决办法

##1.TensorFlow installation not found - running with reduced feature set.

打开网页后无反应。

解决办法:1.将tensorboard 回调到1.15版本。

  1. 在训练过程中可以正常显示,但是不训练就无法正常显示
相关推荐
工作10年+,存储芯片行业3 分钟前
长鑫存储深度分析:国产 DRAM 的崛起、挑战与未来
人工智能·ssd·芯片·存储·pcie·dram·ddr
天天进步20155 分钟前
90天AI接单学习路线:从LLM应用到AI Agent
人工智能·学习
fl1768315 分钟前
工业镀金钨铜合金散热器表面缺陷识别污渍划痕分割数据集labelme格式1000张2类别低分辨率
人工智能·机器学习
vx_Biye_Design6 分钟前
springboot小学生英语学习APP62773-计算机课程设计、毕业设计
java·vue.js·spring boot·后端·python·学习·课程设计
打工仔折腾 AI19 分钟前
用UU远程把家里电脑变成AI Agent常驻服务器:CLI、端口映射与代理实测
运维·服务器·人工智能·后端·python·电脑·ai agent 实战
龙亘川26 分钟前
数智赋能物业不动产治理:亘川智城智慧物业系统实践解析
大数据·人工智能·智慧城市·开源软件·数据可视化
明月_清风29 分钟前
AI Agent 进入系统层:现在有哪些开源项目在解决这个问题?
人工智能·后端
成为深度学习高手33 分钟前
SEMixer:以随机注意力增强patch语义、渐进混合多尺度的轻量长期时序预测模型
人工智能·深度学习·机器学习·数据挖掘·时间序列
泡海椒36 分钟前
JQuick-Excel dateFormat 转换实战:日期值与 FORMAT 显示格式的边界
开发语言·python·excel