mindspore.dataset.audio.MaskAlongAxis

class mindspore.dataset.audio.MaskAlongAxis(mask_start, mask_width, mask_value, axis)[source]

Apply a mask along axis. Mask will be applied from indices [mask_start, mask_start + mask_width).

Parameters
  • mask_start (int) – Starting position of the mask, which must be non negative.

  • mask_width (int) – The width of the mask, which 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.MaskAlongAxis(0, 10, 0.5, 1)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])