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

Clamp variance calculation in certain image metrics #2378

Merged
merged 11 commits into from
Feb 14, 2024

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Feb 13, 2024

What does this PR do?

Fixes #2281
In certain image metrics a variance of pixel values are calculated, which should not be able to be negative. However, in practice it can output a small negative number and even the small epsilon that we add afterwards (to deal with the variance being positive but very small) does rectify this. This PR simply clamps the variance to be 0.

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?
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--2378.org.readthedocs.build/en/2378/

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Feb 13, 2024
@SkafteNicki SkafteNicki added this to the v1.3.x milestone Feb 13, 2024
Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Merging #2378 (acf9327) into master (007a44c) will decrease coverage by 31%.
Report is 1 commits behind head on master.
The diff coverage is 100%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #2378     +/-   ##
========================================
- Coverage      69%     38%    -31%     
========================================
  Files         305     305             
  Lines       17180   17180             
========================================
- Hits        11840    6578   -5262     
- Misses       5340   10602   +5262     

@mergify mergify bot added the ready label Feb 13, 2024
@Borda Borda enabled auto-merge (squash) February 13, 2024 14:59
@Borda Borda merged commit afae59e into master Feb 14, 2024
57 of 58 checks passed
@Borda Borda deleted the bugfix/clamp_variance_image branch February 14, 2024 06:37
Borda pushed a commit that referenced this pull request Mar 16, 2024
Borda pushed a commit that referenced this pull request Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working ready topic: Image
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The divided by zeros problem in low precision when use uqi, sdi, ssim and ms-ssim
3 participants