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

Future proof LPIPs metric #1575

Merged
merged 33 commits into from
Apr 17, 2023
Merged

Future proof LPIPs metric #1575

merged 33 commits into from
Apr 17, 2023

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Mar 1, 2023

What does this PR do?

Fixes #1546
Currently the LPIPs metric relies on the third party package https://github.com/richzhang/PerceptualSimilarity which is not maintained anymore. With the changes to torchvision on how models are loaded, this model will break in the future if we keep relying on the third party package (currently a warning is raised).
This PR copies in the relevant code and updates it to be compatible with torchvision 0.13 and higher.

I have included the required copyright for copying the code.

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 🙃

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Mar 1, 2023
@SkafteNicki SkafteNicki added this to the v0.12 milestone Mar 1, 2023
@SkafteNicki SkafteNicki requested a review from Borda as a code owner March 1, 2023 09:00
@Borda Borda requested a review from lantiga March 1, 2023 10:36
Copy link
Contributor

@lantiga lantiga left a comment

Choose a reason for hiding this comment

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

Approved pending addition of license notice (see comment).

src/torchmetrics/functional/image/lpips.py Show resolved Hide resolved
@Borda Borda added New metric refactoring refactoring and code health labels Mar 3, 2023
Copy link
Contributor

@stancld stancld left a comment

Choose a reason for hiding this comment

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

Some suggestions to the copied code.

src/torchmetrics/functional/image/lpips.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/image/lpips.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/image/lpips.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/image/lpips.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/image/lpips.py Outdated Show resolved Hide resolved
SkafteNicki and others added 3 commits March 11, 2023 15:09
Co-authored-by: Daniel Stancl <46073029+stancld@users.noreply.github.com>
@mergify mergify bot removed the has conflicts label Mar 11, 2023
@mergify mergify bot removed the has conflicts label Mar 21, 2023
@mergify mergify bot removed the has conflicts label Apr 13, 2023
@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #1575 (f750a0e) into master (eeea871) will increase coverage by 0%.
The diff coverage is 96%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #1575    +/-   ##
=======================================
  Coverage      87%     88%            
=======================================
  Files         240     241     +1     
  Lines       13510   13705   +195     
=======================================
+ Hits        11809   12001   +192     
- Misses       1701    1704     +3     

@Borda Borda enabled auto-merge (squash) April 17, 2023 12:03
@mergify mergify bot added the ready label Apr 17, 2023
@mergify mergify bot removed the has conflicts label Apr 17, 2023
@Borda Borda merged commit 7699f85 into master Apr 17, 2023
@Borda Borda deleted the lpips_future_proof branch April 17, 2023 21:55
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 refactoring refactoring and code health topic: Image
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LPIPS generates warning.
4 participants