Skip to content

Commit

Permalink
skip wrong iter number (open-mmlab#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
谢昕辰 committed Jul 27, 2021
1 parent e0a1860 commit 2b021e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/analyze_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def plot_curve(log_dicts, args):
plot_epochs = []
plot_iters = []
plot_values = []
# In some log files, iters number is not correct, `pre_iter` is
# used to prevent generate wrong lines.
pre_iter = -1
for epoch in epochs:
epoch_logs = log_dict[epoch]
if metric not in epoch_logs.keys():
Expand All @@ -39,6 +42,9 @@ def plot_curve(log_dicts, args):
plot_values.append(epoch_logs[metric][0])
else:
for idx in range(len(epoch_logs[metric])):
if pre_iter > epoch_logs['iter'][idx]:
continue
pre_iter = epoch_logs['iter'][idx]
plot_iters.append(epoch_logs['iter'][idx])
plot_values.append(epoch_logs[metric][idx])
ax = plt.gca()
Expand Down

0 comments on commit 2b021e3

Please sign in to comment.