This project involves the classification of music genres using the GTZAN dataset. Various machine learning algorithms and neural networks are employed to achieve the best accuracy.
I used the GTZAN Music Genre Classification Dataset for this project. It contains audio tracks categorized into different genres.
- Data Cleaning and Preprocessing
- Data Visualization
- Model Training and Evaluation
- Logistic Regression
- K-Nearest Neighbors (KNN)
- Decision Tree
- Random Forest
- CatBoost Classifier
- XGBoost Classifier
- Neural Network Implementation
- Model Comparison
- Best Model Selection and Prediction
The initial step involved loading the dataset and performing necessary cleaning. This includes handling missing values, encoding labels, and normalizing the data.
I created visualizations to understand the waveforms of each genre. This helped in gaining insights into the data distribution and characteristics of different genres.
Several machine learning models were trained and evaluated using accuracy as the metric. The results are as follows:
- Logistic Regression: 52.33%
- K-Nearest Neighbors (KNN): 70.67%
- Decision Tree: 62.00%
The comparison of these models was visualized in a graph for better understanding.
Further, advanced models were applied to improve accuracy:
- Random Forest Classifier: 78.00%
- CatBoost Classifier: 83.33%
- XGBoost Classifier: 77.33%
A comparison graph of these advanced models was also created.
A neural network was trained for 100 epochs, achieving a test accuracy of 75%. Accuracy and error plots were generated to visualize the training process.
All the models were compared based on their accuracies. CatBoost Classifier was found to be the best performing model with an accuracy of 83.33%.
The best performing model is the CatBoost Classifier with an accuracy of 83.33%.
main.ipynb
: Contains the code for data cleaning, preprocessing, visualization, model training, evaluation, and predictions.
- Pandas
- NumPy
- Scikit-learn
- Matplotlib
- Seaborn
- CatBoost
- XGBoost
- TensorFlow
- librosa
This project demonstrates the application of various machine learning and neural network techniques for music genre classification. The CatBoost Classifier was the best performing model, achieving an accuracy of 83.33%.
- The dataset used in this project is provided by Kaggle.