我一直无法在tensorboard中绘制我的学习率,因为我使用的ReduceLROnPlateau如下所示:
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=results_path, histogram_freq=1)
reduce_lr = ReduceLROnPlateau(monitor='loss', factor=0.5, verbose=1,
patience=100, min_lr=0.000001)
callbacks = [tensorboard_callback, reduce_lr]
# Compile VAE
vae.compile(optimizer='adam', loss=kl_reconstruction_loss, metrics=["mse", metric_KL,binary_crossentropy])
# Train autoencoder
history = vae.fit(x_train, x_train,
epochs = no_epochs,
batch_size = batch_size,
validation_data=(x_test,x_test,),
callbacks=callbacks)之后,我运行此命令将自定义指标绘制到tensorboard日志:
for epoch in range(len(history.history['mse'])):
with train_summary_writer.as_default():
tf.summary.scalar('metric_KL', history.history['metric_KL'][epoch], step=epoch)通过这样的设置。如果不编写自己的自定义ReduceLROnPlateau,我如何绘制学习率?Thx
发布于 2020-09-01 01:00:54
推荐的方式是覆盖TensorBoard回调。
您可以在这里看到如何做到这一点:Keras: how to output learning rate onto tensorboard。
您只需要为tensorflow.keras而不是普通的keras使用导入来调整代码。
https://stackoverflow.com/questions/63674898
复制相似问题