Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

Does anyone know if Tensorflow normalizes input data by default?

I have grayscale images that values range from roughly 20000-28000. When I normalized the data something odd happened. The network trained for a couple of hundred iterations was doing well in terms of making accurate predictions, but suddenly all predictions went to NaN. Of course, it couldn't recover because TF can't optimize from NaN.

When I didn't normalize the data training went fine and converged.

Any ideas?

1 Answer

0 votes
by (108k points)

The answer to your question is no, TensorFlow doesn’t normalize your input data by default. You have to apply normalization function in your layer like as follows: 

x_train=tf.keras.utils.normalize(x_train, axis=1)

This image is before normalization:

image

And after normalization, it looks like this:

image

Browse Categories

...