This project requires the GTZAN Genre Collection dataset. You can download it automatically using the provided Python script (recommended for TSOAI courses) or manually.
This method uses the dataset_downloader.py script to fetch the data directly from Hugging Face and organize the folders according to the project requirements. No API keys are required.
This script uses standard Python libraries, so usually no extra installation is needed. If requests is missing:
pip install requestsRun the script to download, extract, and clean up the compressed files automatically:
python dataset_downloader.py- Downloads the dataset (
genres.tar.gz) directly from the Marsyas/GTZAN Hugging Face repository. - Creates Directory: It creates a
./GTZAN_datasetfolder in your project root. - Extracts: Unzips the contents directly into that folder.
- Cleanup: Automatically removes the
.tar.gzfile after extraction to save space.
If the script fails or you prefer to manage files yourself:
- Visit the Hugging Face file repository: https://huggingface.co/datasets/marsyas/gtzan/tree/main/data
- Download the file named
genres.tar.gz.
- Create a folder named
GTZAN_datasetin your project root. - Extract the contents of
genres.tar.gzinto that folder.
Your project directory should look exactly like this for the code to run correctly:
DLforAudio/
├── GTZAN_dataset/
│ └── genres/
│ ├── blues/ <-- For every genre, there is a folder.
│ │ └── blues.00000.wav
│ └── ...
└── dataset_downloader.py
Ensure your preprocessing scripts point to the correct folder location:
# preprocess.py (or your config file)
DATASET_PATH = "GTZAN_dataset/genres/"