title: How to fix"DataFrameIterator' object has no attribute 'num_classes'"?
body: <p>I'm loading the training images with tf.keras.preprocessing.image.ImageDataGenerator class. I choose to use flow_from_dataframe function. However, when I try to try to create a layer with num_classes, I got the error: AttributeError: 'DataFrameIterator' object has no attribute 'num_classes' </p>
  
  <pre><code>    datagen=tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255.)
  
  image_data=datagen.flow_from_dataframe(
  dataframe=df[:1700],
  directory='/tf/notebooks/2222/Face Images',
  x_col="Filename",
  y_col="Race",
  batch_size=32,
  #seed=42,
  shuffle=True,
  class_mode="categorical",
  target_size=(224,224))
  
  model = tf.keras.Sequential([
    feature_extractor_layer,
    layers.Dense(image_data.num_classes, activation='softmax')
  ])
  
  model.summary()
  </code></pre>