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:
- Load audio using librosa (
sr=22050) - Convert to mel spectrogram
- Convert to decibel scale
- Resize to 224Γ224
- Normalize
- 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
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support