​How do I use the Tensorboard callback of Keras?​

定义回调函数tensorboard

# callback tensorboard           
tbCallBack = keras.callbacks.TensorBoard(log_dir='./Graph',
histogram_freq=1,
write_graph=True,
write_images=True)

在model.fit中使用

model_history = model.fit(X_train_train, 
y_train_train,
batch_size=batch_size,
epochs=epochs,
verbose=1,
validation_data=(X_train_val, y_train_val),
callbacks = [EarlyStopping(patience=patience,mode='min',verbose=1),
history,
tbCallBack])

在命令行窗口调用

tensorboard --logdir path_to_current_dir/Graph

打开浏览器输入相应地址