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

bug in fid: normalization #25

Open
youngjung opened this issue May 9, 2019 · 3 comments
Open

bug in fid: normalization #25

youngjung opened this issue May 9, 2019 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@youngjung
Copy link

Hi, I found a bug in fid score.

The normalization before inception model is written as:

if self.normalize_input:
x = x.clone()
x[:, 0] = x[:, 0] * (0.229 / 0.5) + (0.485 - 0.5) / 0.5
x[:, 1] = x[:, 1] * (0.224 / 0.5) + (0.456 - 0.5) / 0.5
x[:, 2] = x[:, 2] * (0.225 / 0.5) + (0.406 - 0.5) / 0.5

but it should be:
https://github.com/mseitzer/pytorch-fid/blob/4e366b2fc9fb933bec9f6f24c5e87c3bd9452eda/inception.py#L130-L131

or it should be fixed like:

if self.normalize_input:
    mean = torch.tensor((0.485, 0.456, 0.406)).view(1, 3, 1, 1).cuda()
    std = torch.tensor((0.229, 0.224, 0.225)).view(1, 3, 1, 1).cuda()
    x = (x - mean) / std
@crcrpar
Copy link
Owner

crcrpar commented May 23, 2019

Thank you for your report & suggestion!

I'm sorry for my late response and bothering you by my bad.
To be honest, I did not test/use FID scores.

@crcrpar crcrpar added bug Something isn't working good first issue Good for newcomers labels May 23, 2019
@youngjung
Copy link
Author

Oh, I did not mean to blame you but just wanted to help your repo and other users.
Thanks for your response :)

@crcrpar
Copy link
Owner

crcrpar commented May 24, 2019

Oh, I did not mean to blame you but just wanted to help your repo and other users.

Thank you for your kind words.

I added the link to this issue tentatively to clarify what is wrong & how to fix this.

@crcrpar crcrpar added this to the Bugs to Fix milestone Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants