das.augmentation

Waveform level augmentations.

Individual implementations of Augmentation are callables that accept the signal to augment as an argument and return the augmented signal.

Augmentation parameters can be Constant, or random with Normal or Uniform distribution. Random parameters will be sampled from a given distribution anew for each augmentation.

aug = Gain(gain=Normal(mean=1, std=0.5)); augmented_signal = aug(signal)

Can be configured using a yaml file: ```yaml Gain: # Name of the augmentation class

gain: # arg for the augmentation class
Uniform: # Param type

lower: 0.5 # param args upper: 2 # param args

MaskNoise:
std:
Normal:

mean: 0 std: 0.05

mean:
Constant:

value: 0

NotchFilter:
freq: # Param-type arg
Uniform:

lower: 100 upper: 600

Q: 30 # standard arg samplerate_Hz: 10_000 # standard arg

``` Caution: You need to add a suffix starting with ‘-’ (like “MaskNoise-1”) to the class name

if you want to use a class multiple times

augs = Augmentations.from_yaml(filename)

Classes

Augmentation()

Base class for all augmentations.

Augmentations(augmentations)

Bundles several augmentations.

CircShift(shift)

Circularly shift input along the first axis.

Constant([value])

Constant parameter.

Gain(gain)

Multiply signal with gain factor.

HorizontalFlip(flip)

Horizontally flip signal.

MaskMean(duration)

Replaces stretch of duration samples with mean over that stretch.

MaskNoise([std, mean, duration, add])

Add noise or replace signal by noise for the full duration or a part of it.

Normal([mean, std])

Normally distributed parameter.

NormalizeMax()

Multiply signal with gain factor.

NormalizePercentile(percentile)

Multiply signal with gain factor.

NormalizeStd()

Multiply signal with gain factor.

NotchFilter(freq[, Q, samplerate_Hz])

Notch filter.

Offset(offset)

Add horizontal offset.

Param()

Base class for all parameters.

Uniform([lower, upper])

Uniformly distributed parameter.

Upsampling(factor)

Upsample signal.