如何启动Tensorboard

Tensorboard是TensorFlow官方的一个可视化工具,能够将模型训练过程中的各种汇总数据展示出来,监控TensorFlow运行过程中的计算图,各种指标随着时间的变化趋势以及训练中使用到的图像等信息。

如果要使用TensorBoard展示数据,需要在执行Tensorflow计算图的过程中,将各种数据汇总并记录到日志文件中,然后使用TensorBoard读取这些日志文件,解析数据并生成数据可视化的Web页面,可以在浏览器中观察各种汇总数据。

 

  1. 代码,生成写日志的writer,并将当前的Tensorflow计算图写入日志
import tensorflow as tf
input1 = tf.constant([1.0,2.0,3.0],name="input1")
input2 = tf.Variable(tf.random_uniform([3]),name="input2")
output = tf.add_n([input1,input2],name="add")
#生成写日志的writer,并将当前的Tensorflow计算图写入日志
writer = tf.summary.FileWriter("D://logs",tf.get_default_graph())
writer.close()
  1. 启动tensorboard:cmd到命令窗口,输入:tensorboard --logdir=D://logs

  1. 登陆弹出的网址,就可以看到代码中的图。

 

猜你喜欢

转载自blog.csdn.net/qq_34585338/article/details/89002887