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

[metrics] Update SSIM #4566

Merged
merged 30 commits into from
Nov 19, 2020
Merged

[metrics] Update SSIM #4566

merged 30 commits into from
Nov 19, 2020

Conversation

ydcjeff
Copy link
Contributor

@ydcjeff ydcjeff commented Nov 7, 2020

What does this PR do?

Update SSIM and tests to compare with lower absolute tolerance

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In in short, see following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified; Bugfixes should be including in bug-fix release milestones (m.f.X) and features should be included in (m.X.b) releases.

Did you have fun?

Make sure you had fun coding 🙃

@ydcjeff ydcjeff added bug Something isn't working Metrics labels Nov 7, 2020
@ydcjeff ydcjeff added this to the 1.0.x milestone Nov 7, 2020
@ydcjeff ydcjeff marked this pull request as draft November 7, 2020 13:20
@teddykoker
Copy link
Contributor

Thanks for working on this!

@pep8speaks
Copy link

pep8speaks commented Nov 9, 2020

Hello @ydcjeff! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-11-19 01:34:41 UTC

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

Merging #4566 (9394d81) into master (7383a2c) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #4566   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         117     117           
  Lines        8957    8963    +6     
======================================
+ Hits         8324    8330    +6     
  Misses        633     633           

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Nov 10, 2020

@teddykoker @SkafteNicki mind review a bit so far?
It has now squashed to 7e-5 tolerance

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ! I had a doubt with F.pad, but it is correct usage.

tests/metrics/regression/test_ssim.py Outdated Show resolved Hide resolved
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but I am not a metrics guy 🐰

pytorch_lightning/metrics/functional/ssim.py Outdated Show resolved Hide resolved
@@ -50,7 +51,7 @@ def _sk_metric(preds, target, data_range, multichannel):
[(i.preds, i.target, i.multichannel) for i in _inputs],
)
class TestSSIM(MetricTester):
atol = 1e-3 # TODO: ideally tests should pass with lower tolerance
atol = 6e-5

# TODO: for some reason this test hangs with ddp=True
# @pytest.mark.parametrize("ddp", [True, False])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do tests pass with ddp=True?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test hangs with ddp=True

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ydcjeff I just tried locally and the test does not hang for me when ddp=True.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tried before, the test hangs on drone, will try again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay test still hangs on drone, so lets just disable ddp. Really not sure why it is not working.

pytorch_lightning/metrics/functional/ssim.py Outdated Show resolved Hide resolved
@Borda Borda requested a review from teddykoker November 17, 2020 23:44
@Borda Borda modified the milestones: 1.0.x, 1.1 Nov 18, 2020
Copy link
Contributor

@teddykoker teddykoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DDP tests hang locally for me, but I guess its fine

@ydcjeff ydcjeff merged commit c361213 into master Nov 19, 2020
@ydcjeff ydcjeff deleted the metrics/ssim branch November 19, 2020 05:21
rohitgr7 pushed a commit that referenced this pull request Nov 21, 2020
* [metrics] Update SSIM

* [metrics] Update SSIM

* [metrics] Update SSIM

* [metrics] Update SSIM

* [metrics] update ssim

* dist_sync_on_step True

* [metrics] update ssim

* Update tests/metrics/regression/test_ssim.py

Co-authored-by: chaton <[email protected]>

* Update pytorch_lightning/metrics/functional/ssim.py

Co-authored-by: Jirka Borovec <[email protected]>

* ddp=True

* Update test_ssim.py

Co-authored-by: chaton <[email protected]>
Co-authored-by: Sean Naren <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Nicki Skafte <[email protected]>
@Borda Borda modified the milestones: 1.1, 1.0.x Nov 23, 2020
Borda pushed a commit that referenced this pull request Nov 23, 2020
* [metrics] Update SSIM

* [metrics] Update SSIM

* [metrics] Update SSIM

* [metrics] Update SSIM

* [metrics] update ssim

* dist_sync_on_step True

* [metrics] update ssim

* Update tests/metrics/regression/test_ssim.py

Co-authored-by: chaton <[email protected]>

* Update pytorch_lightning/metrics/functional/ssim.py

Co-authored-by: Jirka Borovec <[email protected]>

* ddp=True

* Update test_ssim.py

Co-authored-by: chaton <[email protected]>
Co-authored-by: Sean Naren <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Nicki Skafte <[email protected]>
(cherry picked from commit c361213)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants