Shortcuts

GTZAN

class torchaudio.datasets.GTZAN(root: Union[str, Path], url: str = 'http://opihi.cs.uvic.ca/sound/genres.tar.gz', folder_in_archive: str = 'genres', download: bool = False, subset: Optional[str] = None)[source]

GTZAN [Tzanetakis et al., 2001] dataset.

Note

Please see http://marsyas.info/downloads/datasets.html if you are planning to use this dataset to publish results.

Note

As of October 2022, the download link is not currently working. Setting download=True in GTZAN dataset will result in a URL connection error.

Parameters:
  • root (str or Path) – Path to the directory where the dataset is found or downloaded.

  • url (str, optional) – The URL to download the dataset from. (default: "http://opihi.cs.uvic.ca/sound/genres.tar.gz")

  • folder_in_archive (str, optional) – The top-level directory of the dataset.

  • download (bool, optional) – Whether to download the dataset if it is not found at root path. (default: False).

  • subset (str or None, optional) – Which subset of the dataset to use. One of "training", "validation", "testing" or None. If None, the entire dataset is used. (default: None).

__getitem__

GTZAN.__getitem__(n: int) Tuple[Tensor, int, str][source]

Load the n-th sample from the dataset.

Parameters:

n (int) – The index of the sample to be loaded

Returns:

Tuple of the following items;

Tensor:

Waveform

int:

Sample rate

str:

Label

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources