seni
seni

Reputation: 711

AttributeError: 'DirectoryIterator' object has no attribute 'map'

I would like to applicate a function (gaussian_filter) to my dataset with map

here is a part of my code

datagen = tf.keras.preprocessing.image.ImageDataGenerator(vertical_flip=True)
training_set = datagen.flow_from_directory('/home/train/',target_size=(224, 224), batch_size = 2)

train_dataset = training_set.map(gaussian_filter, num_parallel_calls=tf.data.experimental.AUTOTUNE)

but I find this error

AttributeError: 'DirectoryIterator' object has no attribute 'map'

Help please, how change the code?

Upvotes: 2

Views: 2536

Answers (1)

Eliza
Eliza

Reputation: 584

you can import your dataset with

tf.data.Dataset.from_generator()

Upvotes: 1

Related Questions