Understanding the code
j13mehul opened this issue · 1 comments
j13mehul commented
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
oarriaga commented
Hi since the image is normalized [0, 1] you then move it to [-.5, .5] and the finally you scaled it by [-1 ,1].