title: Binary Classifier Model trained with batch generated using ImageDataGenerator not giving same result without ImageDataGenerator
body: <p>I have trained my binary classification model by feeding data to the fit_generator using ImageDataGenerator.
  I haven't used any augumentation options, i have used ImageDataGenerator just to resize the image to 224x224x3.
  Below is my training code.</p>
  
  <pre><code>def get_batches(directory, target_size=target_size, batch_size=batch_size, shuffle=False):
      datagen = ImageDataGenerator()
      return datagen.flow_from_directory(directory=directory,
                                            target_size=target_size,
                                            batch_size=batch_size,
                                            class_mode='categorical',
                                            shuffle=shuffle)
  
  
  batches = get_batches(train_dataset, shuffle=True)
  valid_batches = get_batches(validation_dataset, shuffle=True)
  
  model.fit_generator(batches, steps_per_epoch=batches.samples//batch_size, nb_epoch=150,
                      validation_data=valid_batches,
                      callbacks= [early_stop, checkpoint, tensorboard, time_callback, TerminateOnNaN()],
                      validation_steps=valid_batches.samples//batch_size)
  </code></pre>
  
  <p>I have got decent training result and i trained evaluating with a test set.</p>
  
  <pre><code>batches = get_batches(evaluation_dataset, shuffle=True)
  
  pred_acc = top_model.predict_generator(batches, steps=batches.samples//batch_size)
  </code></pre>
  
  <p>I am getting decent evaluation accuracy as expected.</p>
  
  <p>I tried the same operation with predict function instead of predict_generator and i resized the image on my own instead of ImageDataGenerator.</p>
  
  <pre><code>image = cv2.imread ("xyz.bmp")
  image_resized = cv2.resize(image, (224,224))
  
  pred_img = np.expand_dims(image_resized, axis=0)
  
  prediction = top_model.predict(pred_img)
  </code></pre>
  
  <p>I am not getting the same model output when i used predict for the same images fed to predict_generator using ImageDataGenerator.</p>
  
  <p>I can't use ImageDataGenerator for my real time use. </p>
  
  <p>What could be the issue?</p>
  
  <p>Any pointers.</p>
  
  <p>I have seen some discussions similar to this issue <a href="https://github.com/keras-team/keras/issues/3477#issuecomment-360022086" rel="nofollow noreferrer">https://github.com/keras-team/keras/issues/3477#issuecomment-360022086</a>, but for my case i have verified for both positive and negative cases and result is always same irrespective of input image. Looks like ImageDataGenerator is doing some modifiction in data which i need to integrate.</p>
  
  <p>Thanks,
  Partha</p>