Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
/music_clfPublic archive

A music genre classifier built with Tensorflow and deployed as a web app with Heroku and Flask

NotificationsYou must be signed in to change notification settings

awray3/music_clf

Repository files navigation

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

This project was inspired by theFMA dataset, though due totechnical issues with this dataset I decided to instead use theGTZAN 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.ymlconda 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 visitlocalhost: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 thedata and labels in a.json file.

Training

You can view available models to train in themodels.py file.Currently there is logistic regression and a convolutional neural network avialable to train.Modify the model creation section intrain.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

About

A music genre classifier built with Tensorflow and deployed as a web app with Heroku and Flask

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp