title: Prevent predict_generator from shuffling batches
body: <p>I am trying to check the performance of my model on the validation-dataset. As such, I am using <code>predict_generator</code> to return predictions from my <code>validation_generator</code>. However, I am not able to match the predictions with true labels returned from <code>validation_generator.classes</code> since the order of my predictions is mixed up. </p>
  
  <p>This is how I initialize my generator:</p>
  
  <pre><code>BATCH_SIZE = 64
  data_generator = ImageDataGenerator(rescale=1./255, 
                                      validation_split=0.20)
  
  train_generator = data_generator.flow_from_directory(main_path, target_size=(IMAGE_HEIGHT, IMAGE_SIZE), shuffle=False, seed=13,
                                                       class_mode='categorical', batch_size=BATCH_SIZE, subset="training")
  
  validation_generator = data_generator.flow_from_directory(main_path, target_size=(IMAGE_HEIGHT, IMAGE_SIZE), shuffle=False, seed=13,
                                                       class_mode='categorical', batch_size=BATCH_SIZE, subset="validation")
  
  #Found 4473 images belonging to 3 classes.
  #Found 1116 images belonging to 3 classes.
  </code></pre>
  
  <p>Now I am using the predict_generator like so:</p>
  
  <pre><code>validation_steps_per_epoch = np.math.ceil(validation_generator.samples / validation_generator.batch_size)
  
  predictions = model.predict_generator(validation_generator, steps=validation_steps_per_epoch)
  </code></pre>
  
  <p>I realize that there is a mismatch between my validation-data size (=1116) and validation_steps_per_epoch (=1152). Since these two dont match, I find the output <code>predictions</code> is different each time I run model.predict_generator(...).</p>
  
  <p>Is there any way to fix this besides changing batch_size to 1 in order to make sure that generator steps through all samples?</p>
  
  <p>I found someone with a similar issue here <a href="https://stackoverflow.com/questions/51088826/keras-predict-generator-is-shuffling-its-output-when-using-a-keras-utils-sequenc">keras predict_generator is shuffling its output when using a keras.utils.Sequence</a>, however his solution does not fix my problem since I am not writing any custom functions. </p>