title: Normalization of input data in Keras
body: <p>One common task in DL is that you normalize input samples to zero mean and unit variance. One can "manually" perform the normalization using code like this:</p>
  
  <pre><code>mean = np.mean(X, axis = 0)
  std = np.std(X, axis = 0)
  X = [(x - mean)/std for x in X]
  </code></pre>
  
  <p>However, then one must keep the mean and std values around, to normalize the testing data, in addition to the Keras model being trained. Since the mean and std are learnable parameters, perhaps Keras can learn them? Something like this:</p>
  
  <pre><code>m = Sequential()
  m.add(SomeKerasLayzerForNormalizing(...))
  m.add(Conv2D(20, (5, 5), input_shape = (21, 100, 3), padding = 'valid'))
  ... rest of network
  m.add(Dense(1, activation = 'sigmoid'))
  </code></pre>
  
  <p>I hope you understand what I'm getting at.</p>