mindspore.dataset.audio.transforms.TimeMasking

class mindspore.dataset.audio.transforms.TimeMasking(iid_masks=False, time_mask_param=0, mask_start=0, mask_value=0.0)[source]

Apply masking to a spectrogram in the time domain.

Parameters
  • iid_masks (bool, optional) – Whether to apply different masks to each example (default=false).

  • time_mask_param (int) – Maximum possible length of the mask, range: [0, time_length] (default=0). Indices uniformly sampled from [0, time_mask_param].

  • mask_start (int) – Mask start takes effect when iid_masks=true, range: [0, time_length-time_mask_param] (default=0).

  • mask_value (double) – Mask value (default=0.0).

Examples

>>> import numpy as np
>>>
>>> waveform = np.random.random([1, 3, 2])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.TimeMasking(time_mask_param=1)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])