mindspore.dataset.audio.MaskAlongAxisIID

class mindspore.dataset.audio.MaskAlongAxisIID(mask_param, mask_value, axis)[source]

Apply a mask along axis. Mask will be applied from indices [mask_start, mask_start + mask_width), where mask_width is sampled from uniform[0, mask_param], and mask_start from uniform[0, max_length - mask_width], max_length is the number of columns of the specified axis of the spectrogram.

Parameters
  • mask_param (int) – Number of columns to be masked, will be uniformly sampled from [0, mask_param], must be non negative.

  • mask_value (float) – Value to assign to the masked columns.

  • axis (int) – Axis to apply masking on (1 for frequency and 2 for time).

Examples

>>> import numpy as np
>>>
>>> waveform= np.random.random([1, 20, 20])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.MaskAlongAxisIID(5, 0.5, 2)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])