ESC50¶
- class paddle.audio.datasets. ESC50 ( mode: str = 'train', split: int = 1, feat_type: str = 'raw', archive=None, **kwargs ) [源代码] ¶
ESC50 数据集的实现。
参数¶
mode (str,可选) -
'train'
或'dev'
模式两者之一,默认值为'train'
。split (int,可选) - 默认是 1,指定 dev 的文件夹。
feat_type (str,可选) - 默认是 raw,raw 是原始语音,支持 mfcc,spectrogram,melspectrogram,logmelspectrogram。指定从音频提取的语音特征。
archive (dict,可选) - 默认是 None,类中已经设置默认 archive,指定数据集的下载链接和 md5 值。
代码示例¶
>>> import paddle
>>> mode = 'dev'
>>> esc50_dataset = paddle.audio.datasets.ESC50(mode=mode,
... feat_type='raw')
>>> for idx in range(5):
... audio, label = esc50_dataset[idx]
... # do something with audio, label
... print(audio.shape, label)
... # [audio_data_length] , label_id
[220500] 0
[220500] 14
[220500] 36
[220500] 36
[220500] 19
>>> esc50_dataset = paddle.audio.datasets.ESC50(mode=mode,
... feat_type='mfcc',
... n_mfcc=40)
>>> for idx in range(5):
... audio, label = esc50_dataset[idx]
... # do something with mfcc feature, label
... print(audio.shape, label)
... # [feature_dim, length] , label_id
[40, 1723] 0
[40, 1723] 14
[40, 1723] 36
[40, 1723] 36
[40, 1723] 19