title: Keras ImageDataGenerator.flow filenames
body: <p>I have a folder full of 2500 numbered images and a <code>labels.txt</code> file with comma separated labels in the order of the image filename numbers. </p>
  
  <p>I'd like to generate random rotations (10x the number of original training samples, 25000 total), save the new images with numbered names from 1 to 25000, then create a new <code>labels.txt</code> file with comma separated label values in the order of the numbered images. </p>
  
  <p>The main problem I am having with this approach is that I can't seem to either set <code>batch_size</code> to be larger than the total number of images (ideally), or set <code>save_prefix</code> to an iterator that counts images disregarding batch number (since if I do 10 batches of 2500 I think the names will get messed up). Is there any way to do this? Here's my code so far:</p>
  
  <pre><code>n_images = 2500    
  
  datagen = ImageDataGenerator(rotation_range=180)
  
  # fit parameters from data
  datagen.fit(X_train)
  
  # configure batch size and retrieve one batch of images
  for X_batch, y_batch in datagen.flow(X_train, y_train,
                                       seed=42,
                                       batch_size=10*n_images, 
                                       save_to_dir=augment_path, 
                                       save_prefix='aug', 
                                       save_format='png', 
                                       shuffle=False):
  
      # convert labels back and write to file
      nums = y_batch.argmax(axis=1)+1
      write_labels = ','.join([str(i) for i in nums.tolist()])+','
      f = open(augment_path+"/labels.txt", "a+")
      f.write(write_labels)
      f.close()
  
      break
  </code></pre>
  
  <p>Also, what does the last number added to the saved images indicate? For example, <code>aug_0_1685.png</code>.</p>