Skip to content
heliaEDGE
Reference
HELIA

random_background_noises

This module provides classes to build random background noises layers.

Classes

Name Description
RandomBackgroundNoises1D Random background noises 1D

Machine-readable model

class

Apply random background noises to the input.

helia_edge/layers/preprocessing/random_background_noises.py:19

RandomBackgroundNoises1D(noises, amplitude: float | tuple[float, float] = 0.1, num_noises: int = 1, **kwargs={})

Apply random background noises to the input.

Example:

sample_rate = 100
duration = 2*sample_rate
freqs = [2, 5, 15, 20, 25]
noises = np.vstack([
np.sin(2*np.pi*f*np.arange(duration)/sample_rate)
for f in freqs
]).T
lyr = RandomBackgroundNoises(noises=noises, amplitude=0.2, num_noises=2)
y = lyr(x, training=True)

Base class: BaseAugmentation1D.

Inherited from BaseAugmentation: augment_masks(), augment_samples(), augment_targets(), batch_augment(), call().

Parameters of RandomBackgroundNoises1D
NameTypeDefaultDescription
noisesnp.ndarrayRequiredBackground noises to apply.
amplitudefloat | tuple[float, float]0.1Amplitude of the noise. If tuple, amplitude is randomly picked between the values.
method

Generate noise tensor

helia_edge/layers/preprocessing/random_background_noises.py:56

get_random_transformations(input_shape: tuple[int, int, int]) -> dict

Generate noise tensor

Parameters of get_random_transformations
NameTypeDefaultDescription
input_shapetuple[int, ...]RequiredInput shape.
Returns of get_random_transformations
ValueTypeDescription
dictdictDictionary containing the noise tensor.