How loicguillois/music-genre-classification works
This repository is a music-genre classification project with two inference paths: handcrafted audio features with Random Forest, and mel-spectrograms with a CNN. The main user workflow is to pass an audio file and model choice to predict.py, which extracts the matching representation, loads the corresponding saved model, and prints genre probabilities. The README also describes notebook-based dataset analysis and model development for both approaches. The notebook’s implementation was not sampled, so its internal stages and links are documented at a high level only.
Main entry points: predict.py Prediction CLI · music_genre_classification.ipynb Analysis and training
Components 14
Prediction
- Prediction CLI
predict.py - Genre predictions
predict.py
Classical ML
- Feature extraction
predict.py - Random Forest inference
predict.py - RF model artifacts
- Feature-based baseline
music_genre_classification.ipynb
Deep Learning
- Mel-spectrogram extraction
predict.py - CNN inference
predict.py - CNN model artifact
- CNN training
music_genre_classification.ipynb
Model Development
- Analysis and training
music_genre_classification.ipynb - GTZAN dataset
Other components
- Audio user
- Audio file
Connections 14
- Audio user → Prediction CLI: chooses model
predict.py - Audio file → Prediction CLI: supplies audio
predict.py - Prediction CLI → Random Forest inference: dispatches
predict.py - Prediction CLI → CNN inference: dispatches
predict.py - Random Forest inference → Feature extraction: extracts features
predict.py - Random Forest inference → RF model artifacts: loads artifacts
predict.py - CNN inference → Mel-spectrogram extraction: extracts spectrogram
predict.py - CNN inference → CNN model artifact: loads model
predict.py - Random Forest inference → Genre predictions: returns prediction
predict.py - CNN inference → Genre predictions: returns prediction
predict.py - Prediction CLI → Genre predictions: prints results
predict.py - GTZAN dataset → Analysis and training: provides dataset
README.md - Analysis and training → Feature-based baseline: develops baseline
README.md - Analysis and training → CNN training: develops CNN
README.md