-
Notifications
You must be signed in to change notification settings - Fork 405
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
correct the padding related calculation errors in SSIM #2721
Conversation
for more information, see https://pre-commit.ci
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.
can we add test for this fix, pls
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Since we modified the calculation method, all previous quantitativ test will be affected. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2721 +/- ##
========================================
- Coverage 69% 38% -31%
========================================
Files 329 316 -13
Lines 18064 17900 -164
========================================
- Hits 12492 6761 -5731
- Misses 5572 11139 +5567 |
* correct the padding related calculation errors in SSIM * fix doctests * changelog * change test * add test * fix syntax in test_ssim.py * fix syntax in test_ssim.py * fix unittests * fix tolerance --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nicki Skafte Detlefsen <skaftenicki@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit efdb111)
* correct the padding related calculation errors in SSIM * fix doctests * changelog * change test * add test * fix syntax in test_ssim.py * fix syntax in test_ssim.py * fix unittests * fix tolerance --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nicki Skafte Detlefsen <skaftenicki@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit efdb111)
What does this PR do?
Fixes #2718 ,
Before the convolution, we already applied same padding to the image
So ssim_idx_full_image will share the same shape as original image, there is no need to take the padding out again, otherwise it will result in losing information on edge.
Comparison
Before this PR
tensor(1.0000)
, which should be wrong because the edge are different.After this PR
tensor(0.9836)
, which make sense.Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃
📚 Documentation preview 📚: https://torchmetrics--2721.org.readthedocs.build/en/2721/