在callback函数中添加tensorboard,启用tensorboard。

# TensorBoard callback
tensorboard_cb = K.callbacks.TensorBoard(
    log_dir=MyTensorBoardDir,
    histogram_freq=1,
    write_graph=True,
    write_images=True
)

在fit数据的时候,把该回调添加进去

model.fit(x,y,epochs=Epoch,batch_size=16,verbose=2,validation_split=0.2,callbacks=callbackList)