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

Fix number of issues in SpectralDistortionIndex #1808

Merged
merged 7 commits into from
May 29, 2023
Merged

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented May 23, 2023

What does this PR do?

Fixes #1520

Three changes are taking place:

  • Metric supports preds and target having different height/width. Removes restrictive check
  • Corner case can lead to zero division. Adds eps to calculation
  • Metric is slow due to double for-loop over channels, when calculated on many channels. Improves this by vectorizing the inner for loop. A quick timing of the old and new implementation showed that it is similar when number of channels are in the 1-3 range but the new implementation is up to 10x faster for 10 channels.
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--1808.org.readthedocs.build/en/1808/

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label May 23, 2023
@SkafteNicki SkafteNicki added this to the v1.0.0 milestone May 23, 2023
@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Merging #1808 (de02c9d) into master (962f82d) will decrease coverage by 44%.
The diff coverage is 49%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1808     +/-   ##
========================================
- Coverage      87%     43%    -44%     
========================================
  Files         254     254             
  Lines       14278   14303     +25     
========================================
- Hits        12486    6180   -6306     
- Misses       1792    8123   +6331     

@Borda Borda enabled auto-merge (squash) May 23, 2023 18:52
@mergify mergify bot added the ready label May 23, 2023
@mergify mergify bot requested a review from a team May 23, 2023 18:52
@mergify mergify bot removed the has conflicts label May 29, 2023
@Borda Borda merged commit 828c71b into master May 29, 2023
@Borda Borda deleted the bugfix/image_metrics branch May 29, 2023 18:59
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.

Issues with Spectral Distortion Index
3 participants