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. 在训练过程中可以正常显示,但是不训练就无法正常显示
相关推荐
还不秃顶的计科生13 小时前
具身智能论文学习8:Octo: An Open-Source Generalist Robot Policy
人工智能·深度学习·学习·机器学习·语言模型·vla·vlm
新知图书13 小时前
6.4 关键时刻:它自己修好了 Bug
人工智能·agent·ai agent·智能体
深海鱼在掘金13 小时前
深入浅出RAG——第7章:基础篇实战:文档问答机器人
人工智能·typescript·命令行
Jay805913 小时前
一文讲清楚 Epoch、Batch 和 Iteration 的区别
人工智能
深海鱼在掘金13 小时前
深入浅出RAG——第8章:RAG 的局限性及应对策略
人工智能·架构
lucas_AI13 小时前
1.2B 小模型赢过 235B 大模型:NaviDC-OCR 把文档解析卷明白了
人工智能·深度学习·算法
Java&Develop13 小时前
DeltaFStation 宝塔 Linux 部署教程
python
阿星AI工作室13 小时前
一文看懂爆火的 Graph Engineering,以及它和 Loop Engineering、Agent 循环到底啥关系
人工智能
小柯南敲键盘13 小时前
跨境电商图片翻译工具推荐:批量AI翻译+视频字幕+智能抠图
人工智能·python·音视频
王六米。13 小时前
武汉人工智能应用软件开发、企业AI智能体服务怎么排查
人工智能·武汉自动意志科技有限公司·智钳claw·ai漫剧生成·人工智能应用软件开发·企业ai智能体服务