title: Keras: How to provide custom labels using flow_from_directory?
body: <p>I am trying to create a multilabel classification model with keras. As such I have all my images in one folder. Furthermore, I have a CSV file containing a path to each image followed by multiple possible labels</p>
  
  <pre><code>Example of my CSV:
  
  path, x1, x2, x3    
  img/img_00000001.jpg,1,0,1
  img/img_00000002.jpg,0,0,1
  ...
  </code></pre>
  
  <p>I am trying to read in my images using flow_from_directory and provide the respective labels via the CSV. My so far looks like this:</p>
  
  <pre><code>image_path= "C:/user/Images"
  
  
  data_generator = ImageDataGenerator(rescale=1./255, 
                                      validation_split=0.20)
  
  train_generator = data_generator.flow_from_directory(image_path, target_size=(IMAGE_HEIGHT, IMAGE_SIZE), shuffle=True, seed=13,
                                                       class_mode='binary', batch_size=BATCH_SIZE, subset="training")
  
  validation_generator = data_generator.flow_from_directory(image_path, target_size=(IMAGE_HEIGHT, IMAGE_SIZE), shuffle=False, seed=13,
                                                       class_mode='binary', batch_size=BATCH_SIZE, subset="validation")
  </code></pre>
  
  <p>A solution to a similar problem is suggested here: <a href="https://stackoverflow.com/questions/43086548/how-to-manually-specify-class-labels-in-keras-flow-from-directory">How to manually specify class labels in keras flow_from_directory?</a> providing this code:</p>
  
  <pre><code>def multiclass_flow_from_directory(flow_from_directory_gen, multiclasses_getter):
      for x, y in flow_from_directory_gen:
          yield x, multiclasses_getter(x, y)
  </code></pre>
  
  <p>However, I cant figure out how to implement the multiclasses_getter() such that it works. </p>