Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Fix bug in tools/analyse_logs.py caused by wrong plot_iter in some cases. #1428

Merged
merged 3 commits into from
Apr 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions tools/analyze_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,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
# In some log files exist lines of validation,
# `mode` list is used to only collect iter number
# of training line.
for epoch in epochs:
epoch_logs = log_dict[epoch]
if metric not in epoch_logs.keys():
Expand All @@ -43,11 +43,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])
if epoch_logs['mode'][idx] == 'train':
plot_iters.append(epoch_logs['iter'][idx])
plot_values.append(epoch_logs[metric][idx])
ax = plt.gca()
label = legend[i * num_metrics + j]
if metric in ['mIoU', 'mAcc', 'aAcc']:
Expand Down