tensorboard在colab中的实现

colab现在自带tensorboard的魔术方法了,用这个命令就能展示tensorboard

%reload_ext tensorboard
%tensorboard --logdir './callsbacks'



而在代码中则需要写明以下的部分
log_dir= './callsbacks'
if not os.path.exists(log_dir):
os.mkdir(log_dir)
output_model_file = os.path.join(log_dir,"best.h5")
callbacks = [
tf.keras.callbacks.TensorBoard(log_dir),
tf.keras.callbacks.ModelCheckpoint(output_model_file,save_beat_only = True),
tf.keras.callbacks.EarlyStopping(patience=5,min_delta=1e-3),
]
 
 
model.fit(trainX, trainY, batch_size=256, epochs=100, verbose=2, validation_split=0.1,callbacks = callbacks)
 

猜你喜欢

转载自www.cnblogs.com/xingnie/p/12623486.html