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

is there any problem with function normalize in img_utils.py #8

Closed
ghost opened this issue Feb 11, 2019 · 1 comment
Closed

is there any problem with function normalize in img_utils.py #8

ghost opened this issue Feb 11, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 11, 2019

def normalize(img, mean, std):
# pytorch pretrained model need the input range: 0-1
img = img - mean
img = img.astype(np.float32) / 255.0
# img = img / std

return img

hi ycszen, i feel that there is a problem about the normalize function, the img passed into the function is lied in 0-255, while the mean found in the config.py is typically 0.4-0.5, so if the normalize should be changed into

def normalize(img, mean, std):
# pytorch pretrained model need the input range: 0-1

img = img.astype(np.float32) / 255.0
img = img - mean
# img = img / std

return img

thank you very much

@yu-changqian
Copy link
Owner

Yes. You are right. It's my fault with the careless uploading. I have corrected it.

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

1 participant