-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Perceptual Similarity loss #20844
base: master
Are you sure you want to change the base?
Perceptual Similarity loss #20844
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20844 +/- ##
==========================================
+ Coverage 82.04% 84.76% +2.72%
==========================================
Files 559 563 +4
Lines 52367 52590 +223
Branches 8096 8133 +37
==========================================
+ Hits 42964 44580 +1616
+ Misses 7427 5870 -1557
- Partials 1976 2140 +164
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
from keras.src.models import Functional | ||
from keras.src.utils import file_utils | ||
|
||
WEIGHTS_PATH = ( |
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.
Correct weights path should still be added here. Currently I've put a placeholder. I uploaded the LPIPS weights to Hugging Face, as I'm not sure how to upload to storage.googleapis.com
.
name="lpips", | ||
dtype=None, | ||
): | ||
from keras.src.applications import lpips # lazy import |
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.
is there a better way to do this?
As described in #20839.
Conversion of weights partly based on an implementation found here.
Added
keras.losses.PerceptualSimilarity
keras.applications.lpips.LPIPS
TODO
I uploaded the LPIPS weights to Hugging Face, as I'm not sure how to upload to
storage.googleapis.com
.Testing code snippet
Tests both the model and loss object and compares to the torch metrics implementation.