1.可视化神经网络(TensorBoard)
在我们运行完程序后,图结构将以日志文件的形式保存到给定的路径下。
然后在命令行启动Tensorboard
tensorboard --logdir=C://Users//Administrator//Desktop//tensorboard
运行完上述代码后,我们可以得到一个ip》》》》http://SC-201706201654:6006
然后把其复制粘贴到浏览器打开就好
2.可视化day_2 代码的神经网络的建造过程
代码:
![](https://img.haomeiwen.com/i7631208/43264145433bc022.png)
运行结果图:
![](https://img.haomeiwen.com/i7631208/344a6f12fb84865b.png)
有graphs我们可以清晰的看到,学习器的神经结构
3.可视化day_2神经网络的训练过程
![](https://img.haomeiwen.com/i7631208/c81fe7b70b20a327.png)
![](https://img.haomeiwen.com/i7631208/ffd78ffe7361a0c3.png)
训练结果:
(1)scalars结果图(主要看的loss,看看学习器训练有没有效果的):
![](https://img.haomeiwen.com/i7631208/72400737f841779d.png)
从图中我们可以看到loss的值越来越小,说明训练结果有效
(2)ditribution结果图:
![](https://img.haomeiwen.com/i7631208/6575d81799e9a62b.png)
(3)histograms结果图:
![](https://img.haomeiwen.com/i7631208/46c2b5a6e2e1d8f4.png)
4.Tensorflow-报错解决方案
(1)AttributeError: 'module' object has no attribute 'SummaryWriter'
tf.train.SummaryWriter 改为:tf.summary.FileWriter
(2)AttributeError: 'module' object has no attribute 'summaries'
tf.merge_all_summaries() 改为:summary_op = tf.summary.merge_all()
(3)AttributeError: 'module' object has no attribute 'histogram_summary'
tf.histogram_summary() 改为:tf.summary.histogram()
(4)tf.scalar_summary() 改为:tf.summary.scalar()
(5)tf.image_summary() 改为:tf.summary.image()
5.TensorFlow 编程训练7 在tensorboard中查看scalars、graphs、distributions、histograms
问题:先说一下遇到的一些问题,在实现了tensorboard可以显示graphs以后发现了一个问题,就是tensorboard无法显示scalars、distributions、histograms
解决:其实就是tensorflow的版本问题,升级到1.8发现用不了,报错,和之前的错误一样,因此我们要降到1.5
网友评论