espnet2.layers.augmentation.DataAugmentation
espnet2.layers.augmentation.DataAugmentation
class espnet2.layers.augmentation.DataAugmentation(effects: List[Tuple[float, List[Tuple[float, str, Dict]]] | Tuple[float, str, Dict]], apply_n: Tuple[int, int] = [1, 1])
Bases: object
A series of data augmentation effects that can be applied to a given waveform.
Note: Currently we only support single-channel waveforms.
- Parameters:
effects (list) –
a list of effects to be applied to the waveform. .. rubric:: Example
[ : [0.1, “lowpass”, {“cutoff_freq”: 1000, “Q”: 0.707}], [0.1, “highpass”, {“cutoff_freq”: 3000, “Q”: 0.707}], [0.1, “equalization”, {“center_freq”: 1000, “gain”: 0, “Q”: 0.707}], [
0.1, [
[0.3, “speed_perturb”, {“factor”: 0.9}], [0.3, “speed_perturb”, {“factor”: 1.1}], <br/> ] <br/> ],
]
Description: : - The above list defines a series of data augmentation effects that will be randomly sampled to apply to a given waveform.
- The data structure of each element can be either type1=Tuple[float, str, Dict] or type2=Tuple[float, type1].
- In type1, the three values are the weight of sampling this effect, the name (key) of the effect, and the keyword arguments for the effect.
- In type2, the first value is the weight of sampling this effect. The second value is a list of type1 elements which are similarly defined as above.
- Note that he effects defined in each type2 data are mutually exclusive (i.e., only one of them can be applied each time). This can be useful when you want to avoid applying some specific effects at the same time.
apply_n (list) – range of the number of effects to be applied to the waveform.