mindspore.dataset.audio.transforms.FrequencyMasking

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

Apply masking to a spectrogram in the frequency domain.

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

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

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

  • mask_value (float, optional) – 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.FrequencyMasking(frequency_mask_param=1)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])