title: on_epoch_end() not called in keras fit_generator()
body: <p>I followed <a href="https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly" rel="nofollow noreferrer">this tutorial</a> to generate data on-the-fly with the <code>fit_generator()</code> Keras method, to train my Neural Network model.</p>
  
  <p>I created a generator by using the <code>keras.utils.Sequence</code> class .The call to <code>fit_generator()</code> is:</p>
  
  <pre><code>history = model.fit_generator(generator=EVDSSequence(images_train, TRAIN_BATCH_SIZE, INPUT_IMG_DIR, INPUT_JSON_DIR, SPLIT_CHAR, sizeArray, NCHW, shuffle=True),
                                steps_per_epoch=None, epochs=EPOCHS,
                                validation_data=EVDSSequence(images_valid, VALID_BATCH_SIZE, INPUT_IMG_DIR, INPUT_JSON_DIR, SPLIT_CHAR, sizeArray, NCHW, shuffle=True),
                                validation_steps=None,
                                callbacks=callbacksList, verbose=1,
                                workers=0, max_queue_size=1, use_multiprocessing=False)
  </code></pre>
  
  <p><code>steps_per_epoch</code> is <code>None</code>, so the number of steps per epoch is calculated by the Keras <code>__len()__</code> method.</p>
  
  <p>As said in the link above:</p>
  
  <blockquote>
    <p>Here, the method <code>on_epoch_end</code> is triggered once at the very beginning as well as at the end of each epoch. If the <code>shuffle</code> parameter is set to <code>True</code>, we will get a new order of exploration at each pass (or just keep a linear exploration scheme otherwise).</p>
  </blockquote>
  
  <p>My problem is that <code>on_epoch_end()</code> method is called only at the very beginning, but never at the end of each epoch.
  So, at each epoch, the batch order is always the same.</p>
  
  <p>I tried to use <code>np.ceil</code> instead of <code>np.floor</code> in <code>__len__()</code> method, but with no success.</p>
  
  <p>Do you know why <code>on_epoch_end</code> is not called at the end of each epoch? Could you tell me any work-around to shuffle the order of my batches at the end (or at the beginning) of each epoch?</p>
  
  <p>Many thanks!</p>