Music Genre Recommendation website that can identify and recommend 10 different genres of music using Light Gradient Boosting Machine (LGBM). The model achieves an accuracy of 90% on the test set and an F1 score of 0.90. The training data consists of 1000 audio samples each of a duration of 30 seconds. The model is deployed using Flask.
Optuna was used to perform hyperparameter tuning and improve the accuracy of the model by 8% (from 82% to 90%). Once an audio file is uploaded to the website by the user, 58 different features are extracted and passed to the model to accurately identify the genre of music. Relevant song recommendations are generated using cosine similarity and the classified genre of music.
- Upload
.wav
files for music recognition and recommendation - Validate the type of file uploaded to the website
- Predict the genre of music
- Get top 3 song recommendations
- Play the recommended songs on the website
- Display a loading icon while predicting and recommending songs to the user
https://www.kaggle.com/datasets/andradaolteanu/gtzan-dataset-music-genre-classification
- Training Notebook: https://drive.google.com/file/d/1VaO11fxIl262rfSwtsvBOXP8wlhnE12n/view?usp=share_link
- Recommendation Notebook: https://drive.google.com/file/d/1q-u6jvyTLO0WuXmDJuXhKk1SMlh0EVYv/view?usp=sharing
Machine Learning Model | Test Accuracy | F1 Score |
---|---|---|
Light Gradient Boosting Machine (Optimized) | 90% | 0.902 |
Cat Boost Classifier (Default) | 85% | 0.852 |
XGBoost Classifier (Optimized) | 85% | 0.849 |
Random Forest Classifier (Optimized) | 84% | 0.841 |
Random Forest Classifier (Default) | 82% | 0.827 |
Gradient Boosting Classifier (Default) | 82% | 0.823 |
Light Gradient Boosting Machine (Default) | 82% | 0.818 |
XGBoost Classifier (Default) | 81% | 0.808 |
Support Vector Classifier (Default) | 76% | 0.753 |
Logistic Regression (Default) | 73% | 0.729 |
KNN (Default) | 69% | 0.695 |
Decision Tree Classifier (Default) | 59% | 0.582 |
Clone the repository
git clone https://github.com/rprkh/Music-Genre-Recognizer.git
Navigate to the root directory of the project
cd Music-Genre-Recognizer
Install the requirements
pip install -r requirements.txt
Navigate to the Flask App
folder
cd "Flask App"
Run the app.py
script
python app.py
The website should start on http://127.0.0.1:2000/