augmentation_pipeline
Augmentation Pipeline API
Classes:
-
AugmentationPipeline
–Pipeline of augmentation layers
Classes
AugmentationPipeline
AugmentationPipeline(layers: list[keras.Layer], name: str | None = None, force_training: bool = False)
Pipeline of augmentation layers.
Parameters:
-
layers
(list[Layer]
) –List of augmentation layers.
-
force_training
(bool
, default:False
) –Force training mode. Defaults to False.
Example:
layers = [
nse.layers.preprocessing.RandomNoiseDistortion1D(sample_rate=100, frequency=(1, 2), amplitude=(0.5, 2)),
nse.layers.preprocessing.AmplitudeWarp(sample_rate=100, frequency=(1, 2), amplitude=(0.5, 2)),
]
pipeline = nse.layers.preprocessing.AugmentationPipeline(layers)
x = keras.random.normal((10, 100, 1), dtype="float32")
x_aug = pipeline(x, training=True)
plt.plot(x[0].numpy())
plt.plot(x_aug[0].numpy())
plt.show()