Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I read evaluation loss from a tensorboard file?

How can I read a tensorboard file programatically and see all scalar values (loss and metrics)? My question is related to this question on how to read data from tensorboard files.

Following @user1501961's approach and using tensorboard.backend.event_processing.event_accumulator.EventAccumulator, I could read the loss for training. However, I have not figured out the way to see the loss for evaluation. Since the loss for evaluation appears in tensorboard, the data should be somehow buried in the log directory.

Here is part of my script that reads training loss:

In [1]: from tensorboard.backend.event_processing import event_accumulator
In [2]: ea = event_accumulator.EventAccumulator('PATH_TO_LOGGING_DIR', size_guidance={event_accumulator.SCALARS:0});
In [3]: ea.Reload();
In [4]: ea.scalars.Keys()
Out[4]:
['enqueue_input/queue/enqueue_input/random_shuffle_queuefraction_over_250_of_750_full',
 'loss',
 'global_step/sec']
In [5]: ea.Scalars('loss') # only training loss is read.
Out[5]: 
[ScalarEvent(wall_time=1524534430.8867674, step=1, value=0.7076440453529358),
 ScalarEvent(wall_time=1524534523.8320634, step=101, value=0.6497592926025391),
 ScalarEvent(wall_time=1524534554.9782603, step=201, value=0.6366756558418274),
 ScalarEvent(wall_time=1524534586.3355439, step=301, value=0.504106879234314),
...

I use tf.estimator.train_and_evaluate() to save the loss and other metrics, if that matters.

like image 335
Taro Kiritani Avatar asked Dec 09 '25 17:12

Taro Kiritani


1 Answers

Silly me. I found a sub-folder called 'eval' in the logging directory. The EventAccumulator could parse the content the same way as for training data.

like image 124
Taro Kiritani Avatar answered Dec 11 '25 11:12

Taro Kiritani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!