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

LPIPS with Alex net returns Nan #33

Merged
merged 2 commits into from
Sep 10, 2022

Conversation

ilpoli
Copy link
Contributor

@ilpoli ilpoli commented Sep 9, 2022

LPIPS with Alex net returns Nan

The issue is caused by some of the feature layers might zero and it leads to Nan during their normalization. Original implementation uses small epsilon to avoid the issue https://github.com/richzhang/PerceptualSimilarity/blob/31bc1271ae6f13b7e281b9959ac24a5e8f2ed522/lpips/__init__.py#L13

I've verified that results, after changes, are the same as in the original lib (PerceptualSimilarity).

Here are pictures that lead to Nan measure (I hope GitHub attaches images without additional compressing if so, I'll send them in zip):
3132
2908

@ilpoli ilpoli marked this pull request as draft September 9, 2022 20:27
@ilpoli ilpoli marked this pull request as ready for review September 9, 2022 20:31
@ilpoli
Copy link
Contributor Author

ilpoli commented Sep 9, 2022

@francois-rozet could you look at the changes?

@francois-rozet
Copy link
Owner

francois-rozet commented Sep 10, 2022

Hello @ilpoli, thank you for your PR! I made epsilon an argument of LPIPS. I will merge shortly.

@francois-rozet francois-rozet merged commit ded8a27 into francois-rozet:master Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants