Skip to content

About

Messy Mashup challenges participants to classify music genres from noisy mashups instead of clean songs. The dataset contains 10 genres with separated stems: drums, vocals, bass, and others, plus random noise samples. Test tracks mix stems from different songs with tempo synchronization and added noise to simulate realistic audio conditions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

DLGenAI-Project-Messy-Mashup

Messy Mashup challenges participants to classify music genres from noisy mashups instead of clean songs. The dataset contains 10 genres with separated stems: drums, vocals, bass, and others, plus random noise samples. Test tracks mix stems from different songs with tempo synchronization and added noise to simulate realistic audio conditions.

Messy Mashup — Music Genre Classification with Deep Learning

A deep learning pipeline that classifies music genres from stem-based audio mashups — blending drums, bass, vocals, and other tracks from different songs of the same genre, then predicting the genre from the resulting mix.

Built on Kaggle for the Jan 2026 DL/GenAI Project.


Overview

Most music genre classifiers are trained on clean, single-track recordings. This project goes harder: it constructs synthetic mashups by layering stems from multiple songs, adds real-world environmental noise, and trains models to classify genres under those messy conditions.

Four architectures are benchmarked against each other — from a lightweight CNN trained from scratch to a pretrained Audio Spectrogram Transformer (AST) — with macro F1 as the evaluation metric.


🎯 Task

Input: A 10-second audio mashup (constructed from 4 stems: drums, bass, vocals, other)
Output: One of 10 music genres

Genre Genre Genre
Blues Classical Country
Disco Hip-Hop Jazz
Metal Pop Reggae
Rock

🗂️ Dataset

The dataset (messy_mashup) is structured as:

messy_mashup/
├── genres_stems/
│   ├── blues/
│   │   ├── blues.00000/
│   │   │   ├── drums.wav
│   │   │   ├── bass.wav
│   │   │   ├── vocals.wav
│   │   │   └── others.wav
│   │   └── ...
│   └── ... (10 genres total)
├── mashups/          ← test set
└── ESC-50-master/
    └── audio/        ← background noise clips
  • Each song folder contains 4 stems (drums, bass, vocals, other)
  • Environmental noise is sourced from the ESC-50 dataset
  • Up to 100 songs per genre are cached during preprocessing

⚙️ Approach

1. Data Construction — MashupDataset

At each __getitem__ call, a synthetic mashup is built on the fly:

  • A target genre is randomly selected
  • 4 different songs from that genre are sampled
  • One stem is pulled from each song (drums → anchor, others → varied)
  • Stems are BPM-synced using the drums track as the anchor (stretch ratio clipped to [0.8, 1.2])
  • Stems are summed with random volume scaling ([0.6, 1.4])
  • With 90% probability, ESC-50 background noise is added at a random SNR between 5–15 dB

2. Feature Extraction

Raw waveforms are converted to Mel spectrograms (128 mel bins × 1024 time steps) for CNN/ResNet/EfficientNet, and transposed to [time × mel] for AST.

3. Training

Setting Value
Optimizer AdamW
Backbone LR 2e-5
Classification Head LR 1e-4
Weight Decay 0.05
Epochs 20
Batch Size 32
Label Smoothing 0.1
LR Schedule Cosine Annealing
Mixed Precision torch.cuda.amp
Gradient Clipping 1.0

Training is logged to Weights & Biases (wandb).


🧠 Models

SimpleCNN (from scratch)

A lightweight 3-layer convolutional network. Processes mel spectrograms with Conv2d → ReLU → MaxPool blocks, then an AdaptiveAvgPool to flatten, and a linear classifier.

ResNet18 (pretrained, via timm)

ImageNet-pretrained ResNet18, fine-tuned end-to-end. Configured with single-channel input (in_chans=1), dropout regularization (drop_rate=0.3), and max global pooling to capture peak rhythmic/melodic features.

EfficientNet-B0 (pretrained, via timm)

Lightweight and efficient. Uses stochastic depth (drop_path_rate=0.2) in addition to standard dropout for regularization.

AST — Audio Spectrogram Transformer (pretrained, via HuggingFace 🤗)

The best-performing model. Loads MIT/ast-finetuned-audioset-10-10-0.4593 and replaces the 527-class head with a 10-class classifier (ignore_mismatched_sizes=True). Differential learning rates are applied — the backbone gets lr=2e-5, the head gets lr=1e-4.


📊 Results

Models are evaluated on a held-out validation split (10%) using macro F1 score.

CNN (scratch)   →  Baseline
ResNet18        →  Better generalization via ImageNet pretraining
EfficientNet-B0 →  Comparable to ResNet, more parameter-efficient
AST             →  Best — audio-native pretraining dominates

The best AST checkpoint is saved as ast_mit_hypertuned_v1_best.pth.


🚀 Getting Started

Requirements

pip install timm torchmetrics librosa torchaudio wandb transformers scikit-learn

Run on Kaggle

This notebook is designed for the Kaggle environment. Mount the dataset at:

/kaggle/input/jan-2026-dl-gen-ai-project/messy_mashup

Then run all cells top-to-bottom. Training logs will stream to your wandb project messy_mashup_2026.

Inference

Load the saved AST checkpoint and run on the test mashups:

model = SimpleASTWrapper(num_classes=10).to(DEVICE)
model.load_state_dict(torch.load("best_ast_mashup.pth", map_location=DEVICE))
model.eval()

Predictions are saved to submission.csv with columns id and genre.


🛠️ Tech Stack

Library Purpose
PyTorch Model training and inference
torchaudio Audio loading and transforms
librosa BPM detection, mel spectrograms, EDA
timm Pretrained ResNet18 / EfficientNet-B0
HuggingFace Transformers Pretrained AST model
scikit-learn Train/val split, F1 scoring
Weights & Biases Experiment tracking
Kaggle Compute platform and dataset hosting

📁 Repository Structure

├── dl-23f1001357-t12026.ipynb   ← Main notebook (EDA → Training → Inference)
├── submission.csv               ← Generated predictions (after inference)
└── README.md

📝 Notes

  • BPM syncing uses drums as the anchor stem; stretch ratios are clipped to [0.8, 1.2] to avoid unnatural-sounding audio
  • Label smoothing (0.1) helps the model stay appropriately uncertain on messy, overlapping mashups
  • The AST model expects [batch, time, mel] — the standard PyTorch ordering ([batch, mel, time]) must be transposed before passing to the model
  • ESC-50 noise is looped to match mashup length, then mixed at a random SNR

About

Messy Mashup challenges participants to classify music genres from noisy mashups instead of clean songs. The dataset contains 10 genres with separated stems: drums, vocals, bass, and others, plus random noise samples. Test tracks mix stems from different songs with tempo synchronization and added noise to simulate realistic audio conditions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages