Apply repeated random layer choices to an entire batch.
helia_edge/layers/preprocessing/random_augmentation_pipeline.py:9
RandomAugmentation1DPipeline( layers: list[keras.Layer], augmentations_per_sample: int = 1, rate: float = 1.0, batchwise: bool = True, force_training: bool = False, **kwargs={},)Apply repeated random layer choices to an entire batch.
Each round samples one layer for the batch, with replacement, and applies it with probability rate. Inference is unchanged unless force_training is enabled. Candidate layers must produce compatible shapes and structures.
Base class: RandomChoice.
Inherited from RandomChoice: build(), from_config().
Inherited from BaseAugmentation: augment_masks(), augment_sample(), augment_samples(), augment_targets(), get_random_transformations().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
layers | list[keras.Layer] | Required | Nonempty list of candidate augmentation layers. |
augmentations_per_sample | int | 1 | Number of batchwise selection rounds. Zero leaves the input unchanged. |
rate | float | 1.0 | Probability of applying each round, between zero and one. |
batchwise | bool | True | Must be True; per-example layer selection is unsupported. |
force_training | bool | False | Apply augmentation even when training is False or None. |
**kwargs | Any | {} | Base augmentation options, including seed and data_format. |
Raises
| Type | Description |
|---|---|
ValueError | The layer list is empty, the round count is not a nonnegative integer, rate is outside [0, 1], or explicit transformations are used. |
NotImplementedError | batchwise is False. |
augmentations_per_sample
Pythonhelia_edge/layers/preprocessing/random_augmentation_pipeline.py:50
augmentations_per_sample = augmentations_per_samplerate
Pythonhelia_edge/layers/preprocessing/random_augmentation_pipeline.py:51
rate = rateforce_training
Pythonhelia_edge/layers/preprocessing/random_augmentation_pipeline.py:52
force_training = force_trainingbatch_augment
Pythonhelia_edge/layers/preprocessing/random_augmentation_pipeline.py:54
batch_augment(inputs, transformations=None)call
Pythonhelia_edge/layers/preprocessing/random_augmentation_pipeline.py:70
call(inputs, training=None, transformations=None)get_config
Pythonhelia_edge/layers/preprocessing/random_augmentation_pipeline.py:73
get_config()