This repository is based on the recognition of musical genres through supervised and unsupervised learning.
- numpy: https://numpy.org
- librosa: https://librosa.org/doc/latest/index.html
- matplotlib: https://matplotlib.org
- pydub: https://pypi.org/project/pydub/
- pandas: https://pandas.pydata.org
- scikit-learn: https://scikit-learn.org/stable/
$ pip install -r requirements.txt
the dataset used for built this project is the notorious GTZAN dataset, recovered from kaggle (link to database: https://www.kaggle.com/datasets/andradaolteanu/gtzan-dataset-music-genre-classification).
In the utils directory, there are all that classes used for preprocessing the dataset and performing data augmentation (I did not use the csv file available at the previous link, I built my own).
- features_computation: computation of the various features to extract from audio files.
- features_extractions: extraction of the computed features to a csv file in a proper directory.
- features_visualizations: visualization of the single audio signals and the visualization of the various extracted features with a confrontation of the different genres.
- prepare_dataset: check the duration of audio files and perform data augmentation (30s long file -> ten 3s long chunk).
Then we have the core classes of the project:
- main: main class of the project that calls all the other.
- genres_ul_functions: performs k-means clustering and then performs its evaluation.
- genres_sl_functions: performs various classification algorithms (Neural Network, Random Forest, K-Nearest Neighbors, Support Vector Machine) and evaluate their performances with confusion matrix, roc curve and metrics (accuracy, F1-score,...).
- plot_functions: used for defining all the plot functions.
- constants: contains all the constants used in the project.
MULTILAYER PERCEPTRON | RANDOM FOREST | K-NEAREST NEIGHBORS | SUPPORT VECTOR MACHINE | |
---|---|---|---|---|
ACCURACY | 84.80 | 79.33 | 89.80 | 89.40 |
F1-SCORE | 0.85 | 0.79 | 0.90 | 0.89 |
EXECUTION TIME (sec) | 63.72 | 52.76 | 7.73 | 21.40 |