深度学习辅助工具tensorboard可视化实现训练过程的动态监视

1.首先,找到linux服务器中tensorflow-gpu的安装位置

pip show tensorflow-gpu
  • 1
Name: tensorflow-gpu
Version: 1.0.1
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /home/bids/.local/lib/python2.7/site-packages
Requires: mock, numpy, protobuf, wheel, six
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

或者

python
import tensorflow
tensorflow.__path__
dir(tensorflow)

在找到tensorflow-gpu地址后,在改地址目录下寻找tensorboard/tensorboard.py路径。在后面对rensorboard的可视化中会用到该路径

2.在网络训练的代码中(train.py):

log_filepath = '/tmp/keras_log' model.compile(loss='categorical_crossentropy', optimizer=SGD(lr=0.001), metrics=['accuracy']) tb_cb = keras.callbacks.TensorBoard(log_dir=log_filepath, write_images=1, histogram_freq=1) # 设置log的存储位置,将网络权值以图片格式保持在tensorboard中显示,设置每一个周期计算一次网络的 #权值,每层输出值的分布直方图 cbks = [tb_cb] history = model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch, verbose=1, callbacks=cbks, validation_data=(X_test, Y_test))

3.重新开启一个新的终端,输入命令,使得train_history可视化:

python /home/bids/.local/lib/python2.7/site-packages/tensorboard/tensorboard.py --logdir='/tmp/keras_log'

Starting TensorBoard 54 at http://bids:6006(Press CTRL+C to quit)

右键上面的网址打开链接即可。


转载参考来自blog:http://blog.csdn.net/jiandanjinxin/article/details/77155565

你可能感兴趣的:(深度学习辅助工具tensorboard可视化实现训练过程的动态监视)