DCGAN-for-Bird-Generation icon indicating copy to clipboard operation
DCGAN-for-Bird-Generation copied to clipboard

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

Open kunalr326 opened this issue 7 years ago • 15 comments

not able to get the attributes ??

where should i place or edit attribute.txt file to solve this error???

kunalr326 avatar Jun 17 '18 07:06 kunalr326

That seems a problem with keras ImageDataGenerator.

Can you share the load dataset code if you changed it?

How is organized your image directory path?

tensorfreitas avatar Jun 17 '18 10:06 tensorfreitas

hey

i got that done ... was some issue with my tensorflow version.. thanks

kunalr326 avatar Jun 17 '18 10:06 kunalr326

Glad you found it out!

tensorfreitas avatar Jun 17 '18 11:06 tensorfreitas

Hey Goldesel23, I am not able to figure what's wrong here! AttributeError: 'DirectoryIterator' object has no attribute 'flow_from_directory' Can you help me out here?

rohansh-tty avatar Jan 30 '20 09:01 rohansh-tty

Did you edit the loader? What TensorFlow version are you using? It seems related to ImageDataGenerator

tensorfreitas avatar Jan 30 '20 10:01 tensorfreitas

No I haven't edited the loader.


 train_data_gen = image_generator.flow_from_directory(directory=str(data_dir),
                                                      batch_size=BATCH_SIZE,
                                                      shuffle=True,
                                                      target_size=(IMG_HEIGHT, IMG_WIDTH),
                                                      classes = list(CLASS_NAMES))

Tensorflow version == 2.1.0

In data_dir I have set path to all the subfolders containing images of different class. And in CLASS_NAMES, I have added all the class names.

rohansh-tty avatar Jan 31 '20 02:01 rohansh-tty

This code was supposed to work with tensorflow 1. I am not sure that it works with tf2. Like @kunalr326 referred, it could be related to tf version.

tensorfreitas avatar Jan 31 '20 16:01 tensorfreitas

Okay, then I'll check that. Thanks, man!

rohansh-tty avatar Feb 03 '20 12:02 rohansh-tty

Hi, I am getting the same error with TensorFlow 2.8 and I am loading my dataset from a directory. Can anyone please help me with it?

Abdulrahman-CS99 avatar Mar 30 '22 11:03 Abdulrahman-CS99

Hi @Abdulrahman-CS99 This code was written in tensorflow 1. You might need to re-adapt it to Tensorflow V2

tensorfreitas avatar Mar 30 '22 12:03 tensorfreitas

'DirectoryIterator' object has no attribute 'repeat'

can u help plz

satyam2369 avatar Sep 17 '22 19:09 satyam2369

Hi @satyam2369,

Without a look at the changes you made to the code I cannot help much. Notice that the code was written in Tensorflow 1, so you will need to adapt part of it.

tensorfreitas avatar Sep 20 '22 15:09 tensorfreitas

from tensorflow.keras.applications.vgg16 import VGG16 check whether you have imported the VGG16 like this Mine worked with the tensorflow 2.x as well

NityaSG avatar Jan 01 '23 07:01 NityaSG

Which version did you use to make it work?

NoyHala avatar Feb 07 '23 09:02 NoyHala

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

Subu2020 avatar May 20 '23 02:05 Subu2020