<p>Both ways are possible and the choice mostly depends on the way you read the data.</p>

<ul>
<li><p><em>Whole training set</em> normalization is convenient when you can load the whole dataset at once into a numpy array. E.g., <a href="https://www.tensorflow.org/get_started/mnist/beginners#the_mnist_data" rel="nofollow noreferrer">MNIST dataset</a> is usually loaded fully into memory. This way is also preferable in terms of convergence, when the individual images vary significantly: two training images, one is mostly white and the other is mostly black, will have very different means.</p></li>
<li><p><em>Per image</em> normalization is convenient when the images are loaded one by one or in small batches, for example from the TFRecord. It's also the only viable option when the dataset is too large too fit in memory. In this case, it's better to organize the <a href="https://www.tensorflow.org/versions/r0.12/how_tos/reading_data/" rel="nofollow noreferrer">input pipeline in tensorflow</a> and transform the image tensors just like other tensors in the graph. I've seen pretty good accuracy with this normalization in CIFAR-10, so it's a viable way, despite the issues stated earlier. Also note that you can reduce the negative effect via <a href="https://arxiv.org/abs/1502.03167" rel="nofollow noreferrer">batch normalization</a>.</p></li>
</ul>
Which is the correct way to do image normalization?
<p>When preparing train set for neural network training, I find two possible way.</p>

<ol>
<li>The traditional way: calculate the mean on <strong>whole training set</strong>， and minus this <strong>fixed mean value</strong> per image before sending to network. Processing standard deviation in the similar way.</li>
<li>I find tensorflow provides a function <code>tf.image.per_image_standardization</code> that do normalization on <strong>single image</strong>.</li>
</ol>

<p>I wonder which way is more appropriate？</p>