How to add variables to progress bar in Keras?

后端 未结 3 1988
清酒与你
清酒与你 2020-12-04 17:09

I\'d like to monitor eg. the learning rate during training in Keras both in the progress bar and in Tensorboard. I figure there must be a way to specify which variables are

3条回答
  •  不知归路
    2020-12-04 17:53

    I've come to this question because I wanted to log more variables in the Keras progress bar. This is the way I did it after reading the answers here:

    class UpdateMetricsCallback(tf.keras.callbacks.Callback):
      def on_batch_end(self, batch, logs):
        logs.update({'my_batch_metric' : 0.1, 'my_other_batch_metric': 0.2})
      def on_epoch_end(self, epoch, logs):
        logs.update({'my_epoch_metric' : 0.1, 'my_other_epoch_metric': 0.2})
    
    model.fit(...,
      callbacks=[UpdateMetricsCallback()]
    )
    

    I hope it helps others.

提交回复
热议问题