How to merge two DirectoryIterator?
See original GitHub issueHi, I’m looking at the example here: https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
They create 3 iterators: for train, validation and test.
test_datagen = ImageDataGenerator(rescale=1./255)
train_generator = train_datagen.flow_from_directory(
'data/train', # this is the target directory
target_size=(150, 150), # all images will be resized to 150x150
batch_size=batch_size,
class_mode='binary') # since we use binary_crossentropy loss, we need binary labels
validation_generator = test_datagen.flow_from_directory(
'data/validation',
target_size=(150, 150),
batch_size=batch_size,
class_mode='binary')
My question is whether it’s possible to merge\combine train_generator with validation_generator to a single generator that contains images from both train and validation folder.
THX
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Joining two DirectoryIterators in Keras - Stack Overflow
Just combine the generators in another generator, optionally with different augmentation configs: idg1 = ImageDataGenerator(**idg1_configs) ...
Read more >tf.keras.preprocessing.image.DirectoryIterator - TensorFlow
Iterator capable of reading images from a directory on disk.
Read more >Feature #11: Directory Iterator - Decode the Coding Interview ...
Implementing the "Directory Iterator" feature for our "Operating System" project. ... Feature #2: Merge Tweets In Twitter Feed.
Read more >DirectoryIterator::isFile - Manual - PHP
DirectoryIterator ::isFile — Determine if current DirectoryIterator item is a regular file ... Merge the flipped arrays to get rid of duplicate
Read more >Image Preprocessing - Keras Documentation - API Manual
brightness_range: Tuple or list of two floats. ... class_mode=None, seed=seed) # combine generators into one which yields image and masks train_generator ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Iterators are Sequence. You can create you own Sequence
Did you ever get the solution to this problem?