resnet-finetuned-1-hindustani-raag-small
A 1D convolutional ResNet that classifies the raag (melodic framework) of a Hindustani classical music audio clip, across 50 raags.
Model description
The backbone is a 10-block 1D residual network operating on raw audio (resampled to 8kHz,
2-channel). Its architecture and pretrained weights originate from a ResNet trained by
jeevster for Carnatic raga classification; we ported the backbone into this
self-contained transformers-compatible model (no dependency on the original training code)
and added a small classification head
(Linear(300→64) → BatchNorm1d → ReLU → Dropout(0.2) → Linear(64→50)).
Training
We first trained the new head from scratch on frozen-backbone embeddings (a small
hyperparameter sweep over depth/width/batchnorm/dropout). Starting from that trained head, we
then unfroze only the backbone's last residual block and fine-tuned it jointly with the head,
end-to-end on raw audio (5-second random crops, batch size 8, discriminative learning rates),
keeping the rest of the backbone frozen. Training used the 1161-clip train split of
neerajaabhyankar/hindustani-raag-small
(50 raags), with an 85/15 held-out validation split for early stopping.
Evaluation
On the dataset's 92-clip test split: accuracy 0.163, macro-F1 0.132 (chance level for 50 classes is 0.02).
Usage
import datasets
from transformers import AutoModelForAudioClassification, AutoFeatureExtractor
model = AutoModelForAudioClassification.from_pretrained(
"neerajaabhyankar/resnet-finetuned-1-hindustani-raag-small", trust_remote_code=True
)
feature_extractor = AutoFeatureExtractor.from_pretrained(
"neerajaabhyankar/resnet-finetuned-1-hindustani-raag-small", trust_remote_code=True
)
ds = datasets.load_dataset("neerajaabhyankar/hindustani-raag-small", split="test")
audio = ds[0]["audio"]
inputs = feature_extractor(audio["array"], audio["sampling_rate"])
logits = model(inputs["input_values"].unsqueeze(0)).logits
predicted_raag = model.config.id2label[logits.argmax(-1).item()]