[英]Tensorboard plot ReduceLROnPlateau
我一直未能在 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)
之后,我運行它以將自定義指標繪制到張量板日志:
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 的情況下繪制我的學習率? 謝謝
推薦的方法是覆蓋TensorBoard
回調。
您可以在這里看到如何做到這一點: Keras:如何將學習率輸出到 tensorboard 上。
您只需要使用tensorflow.keras
而不是普通的keras
的導入來調整代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.