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
- Raises
TypeError – If mask_param is not of type int.
ValueError – If mask_param is a negative value.
TypeError – If mask_value is not of type float.
TypeError – If axis is not of type int.
ValueError – If axis is not in range of [1, 2].
RuntimeError – If input tensor is not in shape of <…, freq, time>.
- Supported Platforms:
CPU
Examples
>>> import numpy as np >>> import mindspore.dataset as ds >>> import mindspore.dataset.audio as audio >>> >>> 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"])
- Tutorial Examples: