LibriMix¶
- class torchaudio.datasets.LibriMix(root: Union[str, Path], subset: str = 'train-360', num_speakers: int = 2, sample_rate: int = 8000, task: str = 'sep_clean', mode: str = 'min')[source]¶
LibriMix [Cosentino et al., 2020] dataset.
- Parameters:
root (str or Path) – The path to the directory where the directory
Libri2Mix
orLibri3Mix
is stored.subset (str, optional) – The subset to use. Options: [
"train-360"
,"train-100"
,"dev"
, and"test"
] (Default:"train-360"
).num_speakers (int, optional) – The number of speakers, which determines the directories to traverse. The Dataset will traverse
s1
tosN
directories to collect N source audios. (Default: 2)sample_rate (int, optional) – Sample rate of audio files. The
sample_rate
determines which subdirectory the audio are fetched. If any of the audio has a different sample rate, raisesValueError
. Options: [8000, 16000] (Default: 8000)task (str, optional) – The task of LibriMix. Options: [
"enh_single"
,"enh_both"
,"sep_clean"
,"sep_noisy"
] (Default:"sep_clean"
)mode (str, optional) – The mode when creating the mixture. If set to
"min"
, the lengths of mixture and sources are the minimum length of all sources. If set to"max"
, the lengths of mixture and sources are zero padded to the maximum length of all sources. Options: ["min"
,"max"
] (Default:"min"
)
Note
The LibriMix dataset needs to be manually generated. Please check https://github.com/JorisCos/LibriMix
__getitem__¶
get_metadata¶
- LibriMix.get_metadata(key: int) Tuple[int, str, List[str]] [source]¶
Get metadata for the n-th sample from the dataset.
- Parameters:
key (int) – The index of the sample to be loaded
- Returns:
Tuple of the following items;
- int:
Sample rate
- str:
Path to mixed audio
- List of str:
List of paths to source audios