... ds = tf.data.Dataset.from_generator( img_gen.flow_from_directory, args=[flowers], output_types=(tf.float32, tf.float32), output_shapes=([32, 256, 256, 3], [32, 5]) ) # Then just to try it = iter(ds) batch = next(it)