title: What is the right way to preprocess images in Keras while fine-tuning pre-trained models
body: <p>What is the right way to preprocess the data in Keras while fine-tuning the pre-trained models in keras.applications for our own data?</p>
  
  <p>Keras provides the following <code>preprocess_input</code> functions</p>
  
  <p><a href="https://github.com/keras-team/keras/blob/master/keras/applications/imagenet_utils.py#L149" rel="noreferrer">keras.applications.imagenet_utils.preprocess_input</a></p>
  
  <p><a href="https://github.com/keras-team/keras/blob/master/keras/applications/inception_v3.py#L398" rel="noreferrer">keras.applications.inception_v3.preprocess_input</a></p>
  
  <p><a href="https://github.com/keras-team/keras/blob/master/keras/applications/xception.py#L272" rel="noreferrer">keras.applications.xception.preprocess_input</a></p>
  
  <p><a href="https://github.com/keras-team/keras/blob/master/keras/applications/inception_resnet_v2.py#L46" rel="noreferrer">keras.applications.inception_resnet_v2.preprocess_input</a></p>
  
  <p>Looking inside it seems like for inception_v3, xception, and inception_resnet_v2, it calls <a href="https://github.com/keras-team/keras/blob/master/keras/applications/imagenet_utils.py#L149" rel="noreferrer">keras.applications.imagenet_utils.preprocess_input</a> with <code>mode='tf'</code>. While for other models it sets <code>mode='caffe'</code> each of which perform a different transformation. </p>
  
  <p>In the blog post about transfer learning from Francois chollet -- <a href="https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html" rel="noreferrer">https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html</a> -- it is normalized to <code>[0, 1]</code> through a division with 255. Shouldn't the preprocess_input functions in Keras be used instead?</p>
  
  <p>Also it is not clear whether the input images should be in RGB or BGR? Is there any consistency regarding this or is it specific to the pre-trained model being used?</p>