Giter Club home page Giter Club logo

music_clf's Introduction

Music Genre Classification

This repository contains the code for a music genre classifier written in Python using Tensorflow and Flask. You can try it out for yourself on Heroku, though be warned that it might fail for large files due to the computational limits of Heroku.

This project was inspired by the FMA dataset, though due to technical issues with this dataset I decided to instead use the GTZAN dataset.

The model works by starting with a song and splitting it up into ten small chunks. Each chunk is then processed by extracting mel-frequency cepstral coefficients (MFCCs) over many tiny segments, producing an image like the one below:

MFCC's for a song coming from the rock genre

The genre is then predicted using a convolutional neural network, a typical architecture suitable for image-like data such as this.

Usage

Follow these steps if you wish to try out the code on your own machine.

Environment Setup

Install the prerequisites by creating a new anaconda environment:

conda env create -f environment.yml
conda activate genre_rec

Start the Flask server

If you want to test the server functionality with just a local flask server, follow these steps. Run the server:

python app.py

Then visit localhost:5000 in your web browser.

Model Creation

If you wish to recreate the training process, first download the GTZAN dataset and refer to the steps below.

Preprocessing

Once you have downloaded the GTZAN dataset, run the preprocessing script:

python classifier/preprocess.py

This script will extract MFCCs (mel-frequency cepstral coefficients) from the .wav files and store the data and labels in a .json file.

Training

You can view available models to train in the models.py file. Currently there is logistic regression and a convolutional neural network avialable to train. Modify the model creation section in train.py and run

python classifier/train.py

which will give you a model summary, training information, and evaluation diagnostics.

Roadmap

  • Refactor code into scripts
  • Get Flask server working
  • Ping server with client
  • Deploy to Heroku

music_clf's People

Contributors

awray3 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nandasanchit17

music_clf's Issues

Deployment URL

The URL in the description and README are likely outdated, and these should be taken down.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.