title: Keras VGG16 preprocess_input modes
body: <p>I'm using the <a href="https://keras.io/applications/#vgg16" rel="noreferrer">Keras VGG16 model</a>.</p>
  
  <p>I've seen it there is a <a href="https://github.com/keras-team/keras/blob/master/keras/applications/vgg16.py" rel="noreferrer">preprocess_input method to use in conjunction with the VGG16 model</a>.  This method appears to call the <a href="https://github.com/keras-team/keras-applications/blob/master/keras_applications/imagenet_utils.py" rel="noreferrer">preprocess_input method in imagenet_utils.py</a> which (depending on the case) calls <a href="https://github.com/keras-team/keras-applications/blob/master/keras_applications/imagenet_utils.py" rel="noreferrer">_preprocess_numpy_input method in imagenet_utils.py</a>.</p>
  
  <p>The <code>preprocess_input</code> has a <code>mode</code> argument which expects "caffe", "tf", or "torch".  If I'm using the model in Keras with TensorFlow backend, should I absolutely use <code>mode="tf"</code>?</p>
  
  <p>If yes, is this because the VGG16 model loaded by Keras was trained with images which underwent the same preprocessing (i.e. changed input image's range from [0,255] to input range [-1,1])?</p>
  
  <p>Also, should the input images for testing mode also undergo this preprocessing? I'm confident the answer to the last question is yes, but I would like some reassurance.</p>
  
  <p>I would expect Francois Chollet to have done it correctly, but looking at <a href="https://github.com/fchollet/deep-learning-models/blob/master/vgg16.py" rel="noreferrer">https://github.com/fchollet/deep-learning-models/blob/master/vgg16.py</a> either he is or I am wrong about using <code>mode="tf"</code>.</p>
  
  <p><strong>Updated info</strong></p>
  
  <p>@FalconUA directed me to the <a href="http://www.robots.ox.ac.uk/~vgg/research/very_deep/" rel="noreferrer">VGG at Oxford</a> which has a <strong>Models</strong> section with links for the 16-layer model.  The information about the <code>preprocessing_input</code> <code>mode</code> argument <code>tf</code> scaling to -1 to 1 and <code>caffe</code> subtracting some mean values is found by following the link in the <strong>Models</strong> 16-layer model: <a href="https://gist.github.com/ksimonyan/211839e770f7b538e2d8#file-readme-md" rel="noreferrer">information page</a>. In the Description section it says:</p>
  
  <blockquote>
    <p>"In the paper, the model is denoted as the configuration D trained with scale jittering. The input images should be zero-centered by mean pixel (rather than mean image) subtraction. Namely, the following BGR values should be subtracted: [103.939, 116.779, 123.68]."</p>
  </blockquote>