I have a numpy array with shape (34799, 32, 32, 3)
which means (num examples, width, height, channels)
.
Now I normalize the image data with the following code:
def normalize(x):
return (x - 128) / 128
X_train_norm = normalize(X_train)
But the result seems not right, the value of X_train[0][0][0]
is [28 25 24]
, but the output of X_train_norm[0][0][0]
is [1.21875 1.1953125 1.1875]
.
I use the following test code:
test = np.array([[[[28, 25, 24]]]])
print ((test - 128) / 128)
output:
[[[[-0.78125 -0.8046875 -0.8125 ]]]]
Why the normalize
function gets the wrong result?