-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 the bug that when all pixels in an image is ignored, the ac… #1336
Conversation
…curacy calculation raises ZeroDivisionError
Codecov Report
@@ Coverage Diff @@
## master #1336 +/- ##
==========================================
+ Coverage 90.26% 90.32% +0.06%
==========================================
Files 131 132 +1
Lines 7611 7702 +91
Branches 1264 1290 +26
==========================================
+ Hits 6870 6957 +87
Misses 531 531
- Partials 210 214 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
please fix ut error
mmseg/models/losses/accuracy.py
Outdated
@@ -46,10 +46,13 @@ def accuracy(pred, target, topk=1, thresh=None, ignore_index=None): | |||
correct = correct & (pred_value > thresh).t() | |||
correct = correct[:, target != ignore_index] | |||
res = [] | |||
eps = 1e-6 |
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.
Should we use eps in torch.finfo
?
https://pytorch.org/docs/stable/type_info.html?highlight=finfo#torch.torch.finfo
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.
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.
Please also refer to https://discuss.pytorch.org/t/torch-epsilon/30497.
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.
LGTM, except for the definition of eps
.
open-mmlab#1336) * [Fix] Fix the bug that when all pixels in an image is ignored, the accuracy calculation raises ZeroDivisionError * use eps * all close * add ignore test * add eps
open-mmlab#1336) * [Fix] Fix the bug that when all pixels in an image is ignored, the accuracy calculation raises ZeroDivisionError * use eps * all close * add ignore test * add eps
* Add heun * Finish first version of heun * remove bogus * finish * finish * improve * up * up * fix more * change progress bar * Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py * finish * up * up * up
…curacy calculation raises ZeroDivisionError
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
Fix the bug that when all pixels in an image is ignored, the accuracy computation raises ZeroDivisionError
Modification
Fix the bug that when all pixels in an image is ignored, the accuracy computation raises ZeroDivisionError