TensorBoard可视化结构管理工具在Windows下的使用
来源:互联网 发布:复合vb 编辑:程序博客网 时间:2024/05/16 17:37
遵循:BY-SA
署名-相同方式共享 4.0协议
作者:谭东
时间:2017年6月10日
环境:Windows 7
TensorBoard是TensorFlow自带的可视化结构管理和调试优化网络的工具。在我们学习深度学习网络框架时,我们需要更直观的看到各层网络结构和参数,也可以更好的进行调试优化网络。TensorBoard可以实现网络结构的显示,也可以进行显示训练及测试过程中各层参数的变化情况。
我们先看下TensorBoard的大致界面。
我们可以看到顶部有几个功能分类:SCALARS、IMAGES、AUDIO、GRAPHS等。
SCALARS是训练参数统计显示,可以看到整个训练过程中,各个参数的变换情况。
官方英文翻译:
TensorBoard的标量仪表板可视化随时间变化的标量统计; 例如,您可能需要跟踪模型的损失或学习率。 如关键概念所述,您可以比较多个运行,数据按标签组织。 折线图具有以下交互作用:
- 点击每个图表左下角的小蓝色图标将展开图表
- 在图表上拖动矩形区域将放大
- 双击图表将缩小
- 鼠标在图表上会产生十字准线,数据值记录在左侧的运行选择器中。
IMAGES输入和输出标签。
官方翻译:
图像仪表板可以显示通过tf.image_summary保存的png。 设置仪表板,使每行对应一个不同的标签,每列对应一个运行。 由于图像显示板支持任意的png,您可以使用它将自定义可视化(例如,matplotlib散点图)嵌入到TensorBoard中。 此仪表板总是显示每个标签的最新图像。
AUDIO官方英文翻译:
音频仪表板可以嵌入通过tf.audio_summary保存的音频的可播放音频小部件。 设置仪表板,使每行对应一个不同的标签,每列对应一个运行。 此仪表板将为每个标签嵌入最新的音频。
GRAPH是网络结构显示。
官方英文翻译:
图形浏览器可以显示TensorBoard图形,从而可以检查TensorFlow模型。 为了最好地利用图形可视化程序,您应该使用名称范围来对图形中的op进行分层分组,否则图形可能难以破译。 有关更多信息,包括示例,请参阅图形可视化程序教程。
HISTOGRAM是训练过程参数分布情况显示。
官方英文翻译:
直方图仪表板用于可视化Tensor的统计分布随时间变化。它可视化通过tf.histogram_summary记录的数据。现在,它的名字有点不正确,因为它不显示直方图;相反,它显示了一些关于分配的高级统计数据。图表上的每一行表示数据分布中的百分位数:例如,底线显示了最小值随时间变化的方式,中间的行显示了中位数的变化。从上到下,行具有以下含义:[最大,93%,84%,69%,50%,31%,16%,7%,最低]。
这些百分位数也可以视为正态分布的标准偏差边界:[最大值,μ+1.5σ,μ+σ,μ+0.5σ,μ,μ-0.5σ,μ-σ,μ-1.5σ,最小值]使得从内到外读取的着色区域分别具有宽度[σ,2σ,3σ]。
这种直方图可视化有点奇怪,不能有意义地表示多模态分布。我们正在研究一个真正的直方图替换。
官方英文介绍地址:https://github.com/tensorflow/tensorflow/tree/r0.9/tensorflow/tensorboard
注意,本文是在Windows下运行的。
首先我们先写一个Python代码,用来运行显示图形层级结构。
"""Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly."""from __future__ import print_functionimport tensorflow as tfdef add_layer(inputs, in_size, out_size, activation_function=None): # add one more layer and return the output of this layer with tf.name_scope('layer'): with tf.name_scope('weights'): Weights = tf.Variable(tf.random_normal([in_size, out_size]), name='W') with tf.name_scope('biases'): biases = tf.Variable(tf.zeros([1, out_size]) + 0.1, name='b') with tf.name_scope('Wx_plus_b'): Wx_plus_b = tf.add(tf.matmul(inputs, Weights), biases) if activation_function is None: outputs = Wx_plus_b else: outputs = activation_function(Wx_plus_b, ) return outputs# define placeholder for inputs to networkwith tf.name_scope('inputs'): xs = tf.placeholder(tf.float32, [None, 1], name='x_input') ys = tf.placeholder(tf.float32, [None, 1], name='y_input')# add hidden layerl1 = add_layer(xs, 1, 10, activation_function=tf.nn.relu)# add output layerprediction = add_layer(l1, 10, 1, activation_function=None)# the error between prediciton and real datawith tf.name_scope('loss'): loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction), reduction_indices=[1]))with tf.name_scope('train'): train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)sess = tf.Session()# tf.train.SummaryWriter soon be deprecated, use followingif int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: # tensorflow version < 0.12 writer = tf.train.SummaryWriter('C:/logs/', sess.graph)else: # tensorflow version >= 0.12 writer = tf.summary.FileWriter("C:/logs/", sess.graph)# tf.initialize_all_variables() no long valid from# 2017-03-02 if using tensorflow >= 0.12if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: init = tf.initialize_all_variables()else: init = tf.global_variables_initializer()sess.run(init)# direct to the local dir and run this in terminal:# $ tensorboard --logdir=logs然后点击Run运行Python代码。
然后CMD打开命令行终端输入:
tensorboard --logdir=C:/logs
一切正常的话,我们用chrome浏览器打开这个地址:
http://localhost:6006/因为我们代码只是展示了网络层结构,并没有数据。所以我们点击GRAPHS进行查看网络层结构就可以了。
我们的C盘logs下也有相应的日志文件。
版权所有,尊重版权。
微信公众号:
- TensorBoard可视化结构管理工具在Windows下的使用
- windows下使用tensorboard可视化
- windows下在Anaconda中使用tensorboard的方法
- 【Tensorboard】Windows下tensorflow的tensorboard的使用
- Tensorboard在windows系统下的使用方法
- Tensorflow可视化----Tensorboard的使用
- Tensorflow可视化---使用Tensorboard查看网络结构
- Windows下tensorflow的tensorboard的使用
- Windows下TensorBoard使用注意事项
- tensorboard可视化使用
- tensorboard可视化高级使用
- tensorboard无法显示的原因(在Windows下)
- Tensorboard在windows系统下的进入方法
- 【Tensorflow】TensorBoard可视化网络结构和参数Tensorboard windows显示空白
- DL | 快速使用Tensorboard可视化模型参数和模型结构
- Windows下Anaconda中tensorflow的tensorboard使用
- win10下tensorboard的使用
- Win7下TensorBoard的使用
- php读取post数据解析
- MyBatis--注解式开发
- Liunx之信号捕捉与模拟sleep函数
- Vim插件之vim-clang和clang complete
- Resource 接口是 Spring 资源访问的接口,具体的资源访问由该接口的实现类完成
- TensorBoard可视化结构管理工具在Windows下的使用
- 集合的整数表示
- 3.1 Linux中的文件IO (7、8节)
- 《C语言及程序设计初步》_1.7分支结构程序体验_实践6——正差值(方法1)
- DirectX11(二)
- kaldi005 -- 构图
- iOS学习笔记-072.CALayer02——transform属性
- Java数据结构与算法---二叉树
- Android 资源管理