Closed j13mehul closed 5 years ago
def preprocess_input(x, v2=True): x = x.astype('float32') x = x / 255.0 if v2: x = x - 0.5 x = x * 2.0 return x
I know x/255 is normalizing the image. What is the purpose of x-0.5 and x*2.0
Hi since the image is normalized [0, 1] you then move it to [-.5, .5] and the finally you scaled it by [-1 ,1].
I know x/255 is normalizing the image. What is the purpose of x-0.5 and x*2.0