-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 reduce_zero_label
in evaluation
#2504
[Fix] Fix reduce_zero_label
in evaluation
#2504
Conversation
This PR cleans up some unnecessary arguments in evaluation functions. This needs to update the documentation/docstring that I don't have access to. |
Thanks for your contribution. @MengzhangLI please have a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My consideration is that the modifications of intersect_and_union
and other evaluation functions are bc-breaking for the users who use it alone, but I support the modification of CustomDataset
. I suggest keeping input arguments of evaluation functions.
@MeowZheng sounds good! I've reverted my "cleanup" in |
reduce_zero_label
in evaluationreduce_zero_label
in evaluation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint failed, as there is some problem from isort PyCQA/isort#2077, but it has been fixed in PyCQA/isort#2078.
We are working on upgrading the isort, but meet other problems now. :(
We have fixed lint problem of master branch #2520 |
Eval functions shouldn't reduce zero label or apply label_map since that is already done by get_gt_seg_map_by_idx() i.e. LoadAnnotations.__call__().
This is to maintain backward compatibility.
Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
@MeowZheng I rebased this PR on the latest version of |
Codecov ReportBase: 88.33% // Head: 88.30% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2504 +/- ##
==========================================
- Coverage 88.33% 88.30% -0.03%
==========================================
Files 147 147
Lines 8844 8844
Branches 1490 1490
==========================================
- Hits 7812 7810 -2
- Misses 790 793 +3
+ Partials 242 241 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hi, @siddancha many thanks for your nice PR and detailed description! |
…pen-mmlab#2504) * [PipelineTesterMixin] Handle non-image outputs for batch/sinle inference test * style --------- Co-authored-by: William Berman <WLBberman@gmail.com>
Motivation
Through this PR, I (1) fix a bug, and (2) perform some associated cleanup, and (3) add a unit test. The bug occurs during evaluation when two options --
reduce_zero_label=True
, and custom classes are used. The bug was that thereduce_zero_label
is not properly propagated (see details below).Modification
The bug occurs in the initialization of
CustomDataset
where thereduce_zero_label
flag is not propagated to its memberself.gt_seg_map_loader_cfg
:Because the
reduce_zero_label
flag was not being propagated, the zero label reduction was being unnecessarily and explicitly duplicated during the evaluation.As pointed in a previous PR (#2500),
reduce_zero_label
must occur before applying thelabel_map
. Due to this bug, the order gets reversed when both features are used simultaneously.This has been fixed to:
Due to the bug fix, since both
reduce_zero_label
andlabel_map
are being applied inget_gt_seg_map_by_idx()
(i.e.LoadAnnotations.__call__()
), the evaluation does not need perform them anymore.This was pointed out for
label_map
in a previous issue (#1415) that thelabel_map
should not be applied in the evaluation. This was handled by passing an empty dict:Similar to this, I now also set
reduce_label=False
since it is now also being handled byget_gt_seg_map_by_idx()
(i.e.LoadAnnotations.__call__()
).I've added a unit test that tests the
CustomDataset.pre_eval()
function whenreduce_zero_label=True
and custom classes are used. The test fails on the originalmaster
branch but passes with this fix.BC-breaking (Optional)
I do not anticipate this change braking any backward-compatibility.
Checklist