YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

🎡 ResNet34 Music Genre Classifier

πŸ“Œ Model Description

This model uses a ResNet34 architecture trained on mel spectrograms generated from audio files to classify music genres.

Audio input is first converted into a spectrogram using librosa, then resized and passed into the CNN.


βš™οΈ Model Details

  • Architecture: ResNet34
  • Framework: PyTorch
  • Input: Mel Spectrogram (224 Γ— 224)
  • Output: Genre class index
  • File: best_resnet34_librosa.pth

🎧 Input Pipeline (IMPORTANT)

The model does NOT take raw audio directly.

Steps:

  1. Load audio using librosa (sr=22050)
  2. Convert to mel spectrogram
  3. Convert to decibel scale
  4. Resize to 224Γ—224
  5. Normalize
  6. Feed into model

🧠 Classes

Replace this with your actual labels:

0 β†’ Genre_1  
1 β†’ Genre_2  
2 β†’ Genre_3  
3 β†’ Genre_4  
4 β†’ Genre_5  
5 β†’ Genre_6  
6 β†’ Genre_7  
7 β†’ Genre_8  
8 β†’ Genre_9  
9 β†’ Genre_10  

πŸš€ Usage

import torch
import torchvision.models as models

NUM_CLASSES = 10

model = models.resnet34()
model.fc = torch.nn.Linear(model.fc.in_features, NUM_CLASSES)

checkpoint = torch.load("best_resnet34_librosa.pth", map_location="cpu")
model.load_state_dict(checkpoint)

model.eval()

πŸ“Š Performance

Fill this properly:

  • Train Accuracy: XX%
  • Validation Accuracy: XX%

⚠️ Limitations

  • Performance depends heavily on preprocessing consistency
  • Sensitive to noise and audio quality
  • Not robust to different sampling rates

πŸ“¦ Requirements

torch
torchvision
librosa
numpy

πŸ’‘ Notes

  • This is not a Hugging Face Transformers model
  • It requires custom preprocessing before inference
  • For best results, match training pipeline exactly

πŸ”— Future Improvements

  • Add real-time audio classification UI (Gradio)
  • Improve robustness with augmentation
  • Export to TorchScript / ONNX for deployment
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Spaces using MasalaDosai/resnet_genre 2