title: Treating two classes as one in ImageDataGenerator flow from directory
body: <p>I'm currently working with the data generator provided with TensorFlow and I wanted to do some tests by turning my multi-class classification problem into a binary one.</p>
  <p>My current folder layout is as such:</p>
  <pre><code>data/
  ├── 0/  &lt;-- folder containing images of class 0
  ├── 1/
  └── 2/
  </code></pre>
  <p>I'm currently loading it as follows:</p>
  <pre class="lang-py prettyprint-override"><code>train_datagen = ImageDataGenerator(rescale=1./255, validation_split=0.5)
  
  train_generator = train_datagen.flow_from_directory(
      train_data_dir,
      target_size=(input_size, input_size),
      batch_size=batch_size,
      class_mode='categorical',
      subset='training')
  </code></pre>
  <p>I also have a validation subset of course. Though, I'm struggling to figure out how I can make it so I treat class 1 and 2 as a single class without manipulating the actual data or folder structure.</p>
  <p>I found a way to select which classes to use specifically, but that's there was in the documentation.</p>