title: DirectoryIterator in Keras
body: <p>I want to load only images without labels in using data generator. I am training an autoencoder for image reconstruction on imagenet dataset.
  The architecture of Imagenet dataset is similar to given below.</p>
  <p>data/
  data/train/
  data/train/red/
  data/train/blue/
  data/train/green/
  data/train/pink/</p>
  <p>I am using the code given below.</p>
  <pre><code>train_it = datagen.flow_from_directory(directory=”/dataset/Imagenet2012/train/”,
                                         target_size=(224, 224),
                                         color_mode=”rgb”,
                                         batch_size=32,
                                         class_mode=None,
                                         shuffle=True,
                                         seed=42
                                         )
  </code></pre>
  <p>I have changed class_mode to None but still, I am getting the error given below when I call the fit function. Code for my fit function is given below.</p>
  <pre><code>autoencoder.fit(val_it,val_it,
                  batch_size=32,
                  epochs=5,
                  verbose=2,
                  shuffle=True
  
  )
  </code></pre>
  <p>And the error I am getting is</p>
  <pre><code>y argument is not supported when data is a generator or Sequence instance.Instead pass targets
  as the second element of the generator.
  </code></pre>
  <p>I want to pass the original image as y variable in model.fit function. This dataset includes 1281167 images for training. When I try to load all the images using numpy, it is taking approx 6 hours to load.
  Please help me with this.
  Or please suggest me a code for custom data generator.</p>
  <p>Thanks</p>