Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gastonduault/music-classifier
This project uses AI for analyzing songs. With the customized and trained model and the website with Flask you can classify music genres.
https://github.com/gastonduault/music-classifier
flask huggingface model music torch transformer wav
Last synced: about 1 month ago
JSON representation
This project uses AI for analyzing songs. With the customized and trained model and the website with Flask you can classify music genres.
- Host: GitHub
- URL: https://github.com/gastonduault/music-classifier
- Owner: gastonduault
- Created: 2024-11-18T09:53:03.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-18T12:59:03.000Z (about 2 months ago)
- Last Synced: 2024-11-18T14:32:17.479Z (about 2 months ago)
- Topics: flask, huggingface, model, music, torch, transformer, wav
- Language: Python
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Music Genre Classification with AI🎶
This **[model](https://huggingface.co/gastonduault/music-classifier)** classifies music genres based on audio signals. It was fine-tuned on the
**[music_genres_small](https://huggingface.co/datasets/lewtun/music_genres_small)** dataset.This project leverages the **[Wav2Vec2](https://huggingface.co/facebook/wav2vec2-large)** model from Facebook, a state-of-the-art transformer-based architecture for audio processing, to classify music genres. The model is fine-tuned on a dataset of music samples to predict the genre of a given audio file.
The repository includes:
- Preprocessing of audio data.
- Flask service for a website for try the model
- Training scripts for fine-tuning the Wav2Vec2 model.
- Model evaluation and performance analysis.
- Deployment of the trained model for real-world predictions.
---
## Getting Started
### Prerequisites
- Python 3
- `pip install transformers werkzeug flask torch librosa`### Run API Flask
- `Python app.py` (run app.py)
- website on **[http://localhost:5000](http://localhost:5000)**---
## 🖥️ Access the Model➡️ **[Fine-Tuned Model gastonduault/music-classifier](https://huggingface.co/gastonduault/music-classifier)**
### Metrics
- **Validation Accuracy**: 75%
- **F1 Score**: 74%
- **Validation Loss**: 0.77---
## 📊 Dataset
The dataset used for training is `lewtun/music_genres_small` from Hugging Face's datasets library. It contains diverse audio tracks labeled with genres.**Classes:**
- `Electronic`
- `Rock`
- `Punk`
- `Experimental`
- `Hip-Hop`
- `Folk`
- `Chiptune / Glitch`
- `Instrumental`
- `Pop`
- `International`---
## 📂 Repository Structure
- **`training.py`**: Script for training and evaluating the Wav2Vec2 model ***(with Google colab)***.
- **`prediction.py`**: Script to make predictions on new audio files using the trained model.
- **`app.py`**: Python API with Flask framework for testing the model.---
## The interface of testing
![img.png](static/img.png)