Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.73 KB

README.md

File metadata and controls

43 lines (33 loc) · 1.73 KB

Automatic music genre classification with Deep Learning

A streamlit demo

This repo contains the code for a streamlit-based demo of our project (main repo) on Deep Learning for music genre classification as part of the Numerical Analysis for Machine Learning course at Politecnico di Milano, A.Y 2022-2023.

Usage

The demo consists of a streamlit app that allows you to upload a local audio file (with supported formats those of torchaudio.load(...)) or paste a YouTube URL for the model to infer the music genre. In order to use the app you need to run the following command

streamlit run 01_Music_Genre_Classification.py

or python -m streamlit run 01_Music_Genre_Classification.py.

Once you input an audio, you will be able to hear it back and observe its spectrogram representation.

audio_input

The model will then run inference on the given audio. The stacked chart represents the probabilities of each genre across time. The overall scores for the top-5 genres are displayed. Lastly, an interactive representation of the model's latent space is displayed. After completion of inference, the representation of the given song in that feature space will be displayed as black dots.

inference

Requirements

pip install -r requirements.txt

In addition to the libraries listed in requirements.txt, you will need to have FFmpeg installed on your machine with the CLI commands accessible from the environment where the app will run. This might require you to copy the ffmpeg.exe and ffprobe.exe executables in the directory where your python environment's python.exe is located.