tf.keras.preprocessing.image.DirectoryIterator

Iterator capable of reading images from a directory on disk.

Inherits From: Iterator, PyDataset

DEPRECATED.

filepathsList of absolute paths to image files.
labelsClass labels of every observation.
max_queue_size

num_batchesNumber of batches in the PyDataset.
sample_weight

use_multiprocessing

workers

Methods

on_epoch_end

View source

Method called at the end of every epoch.

reset

View source

set_processing_attrs

View source

Sets attributes to use later for processing files into a batch.

Args
image_data_generatorInstance of ImageDataGenerator to use for random transformations and normalization.
target_sizetuple of integers, dimensions to resize input images to.
color_modeOne of "rgb", "rgba", "grayscale". Color mode to read images.
data_formatString, one of channels_first, channels_last.
save_to_dirOptional directory where to save the pictures being yielded, in a viewable format. This is useful for visualizing the random transformations being applied, for debugging purposes.
save_prefixString prefix to use for saving sample images (if save_to_dir is set).
save_formatFormat to use for saving sample images (if save_to_dir is set).
subsetSubset of data ("training" or "validation") if validation_split is set in ImageDataGenerator.
interpolationInterpolation method used to resample the image if the target size is different from that of the loaded image. Supported methods are "nearest", "bilinear", and "bicubic". If PIL version 1.1.3 or newer is installed, "lanczos" is also supported. If PIL version 3.4.0 or newer is installed, "box" and "hamming" are also supported. By default, "nearest" is used.
keep_aspect_ratioBoolean, whether to resize images to a target size without aspect ratio distortion. The image is cropped in the center with target aspect ratio before resizing.

__getitem__

View source

Gets batch at position index.

Args
indexposition of the batch in the PyDataset.

Returns
A batch

__iter__

View source

__len__

View source

allowed_class_modes

{
 'binary',
 'categorical',
 'input',
 'sparse',
 None
}

white_list_formats('png', 'jpg', 'jpeg', 'bmp', 'ppm', 'tif', 'tiff')