Pipeline classkeras.layers.Pipeline(layers, name=None) Applies a series of layers to an input.
This class is useful to build a preprocessing pipeline, in particular an image data augmentation pipeline. Compared to a Sequential model, Pipeline features a few important differences:
Model, just a plain layer.tf.data, the pipeline will also remain tf.data compatible. That is to say, the pipeline will not attempt to convert its inputs to backend-native tensors when in a tf.data context (unlike a Sequential model).Example
from keras import layers preprocessing_pipeline = layers.Pipeline([ layers.AutoContrast(), layers.RandomZoom(0.2), layers.RandomRotation(0.2), ]) # `ds` is a tf.data.Dataset preprocessed_ds = ds.map( preprocessing_pipeline, num_parallel_calls=4, )