Published: 18 Aug 2019 › Updated: 18 Aug 2019

Tensorflow ImageDataGenerator 'DirectoryIterator' object has no attribute 'shape'
If you are using Tensorflow 1.14.0 and ImageDataGenerator, then when fitting the generator to the model, this error appears:
AttributeError: 'DirectoryIterator' object has no attribute 'shape'
FIX
Enter
nano ~/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_generator.py
into the terminal and edit the problem line.
From:
# Convert to a format that supports `next(generator)`.
generator, steps_per_epoch = convert_to_generator_like(
data,
steps_per_epoch=steps_per_epoch,
batch_size=batch_size,
epochs=epochs - initial_epoch,
shuffle=shuffle)
To:
generator = data
# Convert to a format that supports `next(generator)`.
# generator, steps_per_epoch = convert_to_generator_like(
# data,
# steps_per_epoch=steps_per_epoch,
# batch_size=batch_size,
# epochs=epochs - initial_epoch,
# shuffle=shuffle)
Leave Tensorflow ImageDataGenerator 'DirectoryIterator' object has no attribute 'shape' to:
Read more #python posts
Best Posts From Octav
We have not curated any of octav's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Octav
- luarocks install loadcaffe: Error: No results matching query were found
- Tensorflow ImageDataGenerator 'DirectoryIterator' object has no attribute 'shape'
- How2: Swift 4 TF
- Etherum mining in Genesis - Review/Experience - Part IV - Last
- Merge 2 directories in python
- ssh not working/Connection refused on OrangePi/Debian
- California pepper origin Turkey & origin Spain & made in Romania
- Corporate
- Bugfixing before the release
- Bitcoin curve through a sound synth