TensorBoard 计算图的可视化
简介
tensorflow 配套的可视化工具, 将你的张量图画出来.
当训练一个巨大的网络的时候, 计算图既复杂又令人困惑. TensorBoard 提供了一系列的组件, 可以看到 learning rate 的变化, 看到 objective function 的变化.
tfboard 读取 tf 运行时你记下的 events files, 来进行可视化. 这些 events files 包含了你记下的 summary data, 它是 protobuffer 格式, 并非文本文件.
搭配 Estimator 使用
推荐使用 风格.
类与方法
tensorflow.python.summary.writer.writer.FileWriter(SummaryToEventTransformer)
类.__init__(self, logdir, graph=None,...)
构造函数, Creates aFileWriter
and an event file.-
tensorflow.python.summary.summary
模块.-
scalar(name, tensor, ..)
Outputs aSummary
protocol buffer containing a single scalar value. -
image(name, tensor, max_outputs=3, collections=None, family=None)
Outputs aSummary
protocol buffer with images.
images are built fromtensor
which must be 4-D with shape[batch_size, height, width, channels]
and wherechannels
can be:- 1-
tensor
is interpreted as Grayscale. - 3-
tensor
is interpreted as RGB. - 4-
tensor
is interpreted as RGBA.
- 1-
-
histogram(name, values, collections=None, family=None)
Adding a histogram summary makes it possible to visualize your data’s distribution in TensorBoard.
-
打开web页面
在命令行中 敲tensorboard --logdir=D:\tf_models\iris
, 根据提示打开URL即可.
比如我的为http://yichu-amd:6006/
.
效果截图
图3-1 logdir中的文件
图3-2 炫酷的可视化效果
figure 3 计算图的可视化