in ss_baselines/savi/run.py [0:0]
def find_best_ckpt_idx(event_dir_path, min_step=-1, max_step=10000):
events = os.listdir(event_dir_path)
max_value = 0
max_index = -1
for event in events:
if "events" not in event:
continue
iterator = tf.compat.v1.train.summary_iterator(os.path.join(event_dir_path, event))
for e in iterator:
if len(e.summary.value) == 0:
continue
if not e.summary.value[0].tag.startswith('val'):
break
# if 'softspl' not in e.summary.value[0].tag:
if 'spl' not in e.summary.value[0].tag or 'softspl' in e.summary.value[0].tag:
continue
if not min_step <= e.step <= max_step:
continue
if len(e.summary.value) > 0 and e.summary.value[0].simple_value > max_value:
max_value = e.summary.value[0].simple_value
max_index = e.step
if max_index == -1:
print('No max index is found in {}'.format(event_dir_path))
else:
print('The best index in {} is {}'.format(event_dir_path, max_index))
return max_index