TimeMasking¶
- class torchaudio.transforms.TimeMasking(time_mask_param: int, iid_masks: bool = False, p: float = 1.0)[source]¶
Apply masking to a spectrogram in the time domain.
Proposed in SpecAugment [Park et al., 2019].
- Parameters:
time_mask_param (int) – maximum possible length of the mask. Indices uniformly sampled from [0, time_mask_param).
iid_masks (bool, optional) – whether to apply different masks to each example/channel in the batch. (Default:
False
) This option is applicable only when the input tensor >= 3D.p (float, optional) – maximum proportion of time steps that can be masked. Must be within range [0.0, 1.0]. (Default: 1.0)
- Example
>>> spectrogram = torchaudio.transforms.Spectrogram() >>> masking = torchaudio.transforms.TimeMasking(time_mask_param=80) >>> >>> original = spectrogram(waveform) >>> masked = masking(original)
- Tutorials using
TimeMasking
: - Audio Feature Augmentation