一、在终端中输入
tensorboard --logdir runs\train(file directory),当前目录的文件相对地址,比如runs/trains,注意这里只能是在tensorboard的存储event文件的父目录
它会跳出
点击网址即可使用
二、
(1) 在tensorflow中的用法:
# Create a callback ,初始化tensorboard
tf_callback = tf.keras.callbacks.TensorBoard(log_dir="./logs")
# Pass in the callback when fitting the model ,显示调用tensorboard
model.fit(X_train, y_train, epochs=5, callbacks=[tf_callback])
这里附上完整使用代码:
import tensorflow as tf
fashion_mnist = tf.keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
train_images = tf.expand_dims(train_images, axis=3)
test_images = tf.expand_dims(test_images, axis=3)
train_images = train_images[:1000]
train_labels = train_labels[:1000]
test_images = test_images[:100]
test_labels = test_labels[:100]
class FasionClassic:
def __init__(self):
self.cnn_1 = tf.keras.layers.Conv2D(32, 3, activation=tf.nn.relu)
self.batch_norm_1 = tf.keras.layers.BatchNormalization()
self.cnn_2 = tf.keras.layers.Conv2D(64, 3, activation=tf.nn.relu)
self.batch_norm_2 = tf.keras.layers.BatchNormalizati