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

What does this code mean #4

Closed
2p990i9hpral opened this issue Apr 24, 2019 · 2 comments
Closed

What does this code mean #4

2p990i9hpral opened this issue Apr 24, 2019 · 2 comments

Comments

@2p990i9hpral
Copy link

i don't understand why below code is used

I expect two lines to be Convert range of x from 0 to 1,
but the subtraction codes below are totally incomprehensible.

i want to know why these code is used
thank you

@staticmethod
def preprocess_input(img):
	x = img - img.min()
	x = 255.0 * x / x.max()

	x[..., 0] -= 103.939
	x[..., 1] -= 116.779
	x[..., 2] -= 123.68
	return x
@mahehu
Copy link
Owner

mahehu commented Apr 24, 2019

The subtraction originates from the mean color values of the imagenet dataset. The same procedure is used also in keras.applications, whose pretrained models we use as the starting point of our training process.

We are preparing a new pull of a set of faster and more accurate models. In the next version (in the next few weeks), we are dropping this subtraction to simplify the code.

@mahehu mahehu closed this as completed Apr 24, 2019
@2p990i9hpral
Copy link
Author

The subtraction originates from the mean color values of the imagenet dataset. The same procedure is used also in keras.applications, whose pretrained models we use as the starting point of our training process.

We are preparing a new pull of a set of faster and more accurate models. In the next version (in the next few weeks), we are dropping this subtraction to simplify the code.

It is very good news.
I'm looking forward to the next release.
Please do your best!

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

2 participants