Kevin - 1 year ago 578

Python Question

On http://cs231n.github.io/neural-networks-2/ it is mentioned that for convolutional neural networks it is preferred to preprocess data using mean subtraction and normalization techniques.

I was just wondering how would it be best approached using Tensorflow.

Mean substraction

`X -= np.mean(X)`

Normalization

`X /= np.std(X, axis = 0)`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

You're looking for `tf.image.per_image_whitening(image)`

:

Linearly scales image to have zero mean and unit norm.

This op computes (x - mean) / adjusted_stddev, where mean is the average of all values in image, and adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements())).

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**