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

data normalization - possible bug #20

Closed
rosenfeldamir opened this issue Mar 5, 2019 · 4 comments
Closed

data normalization - possible bug #20

rosenfeldamir opened this issue Mar 5, 2019 · 4 comments

Comments

@rosenfeldamir
Copy link

I noticed that the data normalization is

transforms.Normalize((0.5, 0.5, 0.5),(0.5, 0.5, 0.5))

(for example in twoafc_dataset.py).
The imagenet normalization coefficients are
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
This raises the questions:

  1. possibly you confused mean with variance? (the Normalize function accepts std as the second argument, not variance)
  2. any reason behind the design choice not to use the imagenet normalization?
@richzhang
Copy link
Owner

richzhang commented Mar 5, 2019

This "normalize" converts images from [0,+1] to [-1,+1]. We do the actual imagenet normalization here: https://github.com/richzhang/PerceptualSimilarity/blob/master/models/networks_basic.py#L112 .

@zakajd
Copy link

zakajd commented Jun 16, 2020

Hi
I don't understand where did you get the normalization values.
Currently you are using mean = [ -.030,-.088,-.188] and std = [.458,.448,.450] which doesn't correspond to ImageNet statistics.

So the question is: Where did you get this values and what do they mean?

@richzhang
Copy link
Owner

Thanks for the question. The imagenet statistics assume images are normalized between [0,1]. This code uses images from [-1,+1], so the appropriate transformation is done (notice that the std is just doubled)

@zakajd
Copy link

zakajd commented Jun 16, 2020

Thank you for the fast answer =)

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

No branches or pull requests

3 participants