Coder Social home page Coder Social logo

genretron's Introduction

Genretron

Genretron aims to be an automatic music genre classifier. That means that given any song (even one that you just made) it will try to classify it in one of its learned genres. It uses Deep Learning techniques to learn the genre of the songs.

Genretron is part of Carmine Paolino's Master Thesis at Universiteit van Amsterdam.

Installation

Dependencies

Install Python 2.7+ with virtualenv, HDF5, libsndfile, freetype, libpng, a fortran compiler and postgresql.

On a Mac with Homebrew:

brew install python libsndfile homebrew/science/hdf5 freetype libpng gcc postgresql homebrew/python/matplotlib homebrew/python/numpy homebrew/python/scipy
pip install virtualenv

On Ubuntu 14.04 LTS:

sudo apt-get install libsndfile1-dev python-virtualenv python-tables python-matplotlib python-scikits-learn python-sqlalchemy python-psycopg2 python-yaml python-numpy python-scipy python-progressbar procmail

On Fedora 24:

sudo dnf install gcc-c++ libsndfile-devel python2-virtualenv python-tables python2-matplotlib python2-scikit-learn python-sqlalchemy python-psycopg2 PyYAML python2-numpy python2-scipy python-progressbar Cython procmail

Genretron

git clone --recursive https://github.com/crmne/Genretron.git
cd Genretron
virtualenv --system-site-packages env
. env/bin/activate
python setup.py install

Downloading the datasets

Make sure you set the environment variable PYLEARN2_DATA_PATH to a directory of your preference where you want the datasets to be stored. For example:

export PYLEARN2_DATA_PATH=/data/lisa/data

For your own convenience, you might want to add that line to your .bashrc

Then simply run

bin/download_gtzan

This procedure will download the classic Music Information Retrieval Genre Classification dataset GTZAN and unpack it in your PYLEARN2_DATA_PATH directory so it's ready for use with Genretron.

If you wanna download MNIST, run:

python bin/download_mnist

Training of the neural network

bin/train experiments/test/conv.yaml

Training on a cluster with Jobman

Set the GENRETRON_PATH, DB_TABLE and THEANO_FLAGS environment variables. For example:

export GENRETRON_PATH=$HOME/Genretron
export DB_TABLE='postgres://user[:pass]@host/dbname?table=tablename'
export THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32

Then schedule the jobs with jobman:

bin/jobman_sqlschedule experiments/jobman/hyperparameters/experiment_name.yaml $DB_TABLE tablename

Execution of the training jobs on a single machine

bin/jobman sql -n [number of jobs] $DB_TABLE $GENRETRON_PATH/resuts

Execution of the training jobs on a cluster with SLURM

sbatch -t [time in minutes] -p [cluster partition] -n [number of processes] -N [number of nodes] bin/launcher.slurm 1 $DB_TABLE

Execution of the training jobs on a cluster with PBS

for i in {1..[number of jobs]}; do qsub -lwalltime=[time in hh:mm:ss] -v CONSECUTIVE_JOBS=1,DB_TABLE=$DB_TABLE bin/launcher.pbs; done

Prediction

bin/predict results/experiments/test/conv.pkl song1.wav song2.wav ...

genretron's People

Contributors

crmne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

genretron's Issues

Not predicting properly

Hello,

I have installed and tried to predict the genre of a rock song. It predicted it as 'pop'. But it is predicting properly if I try to predict from the songs from dataset.

Please let me know if I am doing anything wrong. Please suggest.

Thanks,
Sateesh

Genre data is missing

https://dl.dropboxusercontent.com/u/2729268/genres.tar.gz gives a 404 and the file downloaded is zero bytes.

(env) ❯ bin/download_gtzan
GTZAN dataset already downloaded in /Users/alexbaldwin/Sites/genretron/data/GTZAN/genres.tar.gz. Do you want to download it again? [Y/n] Y
Downloading https://dl.dropboxusercontent.com/u/2729268/genres.tar.gz
Traceback (most recent call last):
  File "bin/download_gtzan", line 34, in <module>
    utils.urlretrieve(gtzan_origin, gtzan_dest)
  File "build/bdist.macosx-10.12-x86_64/egg/genretron/utils.py", line 90, in urlretrieve
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 98, in urlretrieve
    return opener.retrieve(url, filename, reporthook, data)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 271, in retrieve
    reporthook(blocknum, bs, size)
  File "build/bdist.macosx-10.12-x86_64/egg/genretron/utils.py", line 85, in dlProgress
  File "/Users/alexbaldwin/Sites/genretron/env/lib/python2.7/site-packages/progressbar/__init__.py", line 306, in start
    if self.maxval < 0: raise ValueError('Value out of range')
ValueError: Value out of range

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.