def _load_generator(self, input_dir, batch_size=None, class_mode=None, augmentation=False):
    ' Load Generator\n\n        Load files from an input directory into a Keras generator.\n\n        Parameters\n        ----------\n        input_dir : str\n            Input directory\n        batch_size : int, optional\n            Batch size\n        class_mode : str, optional\n            Generator class mode\n        shuffle : bool, optional\n            Option to shuffle input files\n\n        Returns\n        -------\n        keras_preprocessing.image.DirectoryIterator\n            Keras generator\n\n        '
    if augmentation:
        datagen = ImageDataGenerator(rescale=(1.0 / 255), shear_range=0.2, zoom_range=0.2, horizontal_flip=True)
    else:
        datagen = ImageDataGenerator(rescale=(1.0 / 255))
    generator = datagen.flow_from_directory(input_dir, target_size=self._target_size, batch_size=batch_size, class_mode=class_mode, shuffle=False)
    generator.steps = (generator.n // generator.batch_size)
    return generator
Load Generator

Load files from an input directory into a Keras generator.

Parameters
----------
input_dir : str
    Input directory
batch_size : int, optional
    Batch size
class_mode : str, optional
    Generator class mode
shuffle : bool, optional
    Option to shuffle input files

Returns
-------
keras_preprocessing.image.DirectoryIterator
    Keras generator
def _load_generator(self, input_dir, batch_size=None, class_mode=None, augmentation=False):
    ' Load Generator\n\n        Load files from an input directory into a Keras generator.\n\n        Parameters\n        ----------\n        input_dir : str\n            Input directory\n        batch_size : int, optional\n            Batch size\n        class_mode : str, optional\n            Generator class mode\n        shuffle : bool, optional\n            Option to shuffle input files\n\n        Returns\n        -------\n        keras_preprocessing.image.DirectoryIterator\n            Keras generator\n\n        '
    if augmentation:
        datagen = ImageDataGenerator(rescale=(1.0 / 255), shear_range=0.2, zoom_range=0.2, horizontal_flip=True)
    else:
        datagen = ImageDataGenerator(rescale=(1.0 / 255))
    generator = datagen.flow_from_directory(input_dir, target_size=self._target_size, batch_size=batch_size, class_mode=class_mode, shuffle=False)
    generator.steps = (generator.n // generator.batch_size)
    return generator