Last active
December 18, 2020 07:06
-
-
Save Taehun/0c5f6c3e7c9f0ff4b8d05bcc521378d0 to your computer and use it in GitHub Desktop.
Tensorflow 2.x에서 로그 파일 (events.out.tfevents.*)에 기록된 값 출력 하기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
from tensorflow.core.util import event_pb2 | |
from pathlib import Path | |
train_metrics = [ | |
"Loss/classification_loss", | |
"Loss/localization_loss", | |
"Loss/normalized_total_loss", | |
"Loss/regularization_loss", | |
"Loss/total_loss", | |
"learning_rate", | |
] | |
event_files = [str(f) for f in Path('./logs/train').rglob('events.out.*')] | |
for event_file in event_files: | |
serialized_examples = tf.data.TFRecordDataset(event_file) | |
for serialized_example in serialized_examples: | |
event = event_pb2.Event.FromString(serialized_example.numpy()) | |
for value in event.summary.value: | |
if value.tag in train_metrics: | |
t = tf.make_ndarray(value.tensor) | |
print(value.tag, event.step, t, type(t)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment