Skip to content

A small bug in tools/analyse_logs.py caused by wrong plot_iter in some cases. #1426

@Y-M-Y

Description

@Y-M-Y

Hi, thank you for constructing such a fabulous toolbox. I meet a problem in using tools/analyse_logs.py. To be specific, there might be some bugs with the variable plot_iter in plotting iter-based curves.

Describe the bug
When using tools/analyse_logs.py to plot curves of iter-based variables such lr and loss, the curve will be wrong like the following figs. The lr schedule is poly, the curve should be a line, but it is wrong from iter200 to iter1344. So as the loss curve.
image
image

When the iteration of validation(eg. 1334) is larger than the interval of evaluation(eg. 200), the curve will be wrong. The code in analyse_logs generated the wrong plot_iter as x.

Reproduction

1.What command or script did you run?
python tools/analyze_logs.py xxx.log.json --keys lr

2.Here's my json logs.
logfile.zip

Environment

MMSegmentation v0.22.1

Bug fix

I have already analyzed the bug, it must be the error of plot_iter caused by 'iter': in the first 'mode': 'val' line in .json logs. The if...continue (line46-lin47) filtering too much useful iters in the list plot_iter. Maybe we can fix it by ignoring the iter of val mode.

                 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])

However, due to the limitation of my ability, I can't fix it. Sorry!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions