-
Notifications
You must be signed in to change notification settings - Fork 500
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
Wrong normalization? #86
Comments
Thanks for the question. This has caused some confusion. The mean/std is recomputed to expect images from [-1, +1] instead of [0, +1] (which is what the values are for above). After the scaling layer, the results are the same. |
Thank you for the quick response. I should have read more carefully the other issues :) Here the computation in detail if somebody comes across this issue. Let us say we have a pixel in the R-channel with a pixel value of 240. I rescale it to [-1, 1] with 2 * 240/255 - 1 = 15/17. Then I normalize it with ScalingLayer and get (15/17 - -0.030)/0.458 = 1.99203. Regular VGG would do (240/255 - 0.485)/0.229 = 1.99203. So the normalization is indeed correct. |
I have a small problem. Since it is to be compatible with imagenet's mean/std, it is not good to input the img of [0, 1] from the beginning. |
Still confused about this. if i do this before i put it into lpips , does it means that i can just delete the scaling layers? |
Yes, that's right |
ok, thank you : ) |
Where does the mean/std come from in ScalingLayer? The VGG16 mean/std is mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225].
The text was updated successfully, but these errors were encountered: