annotate README.md @ 27:55b7b5a5cf43

respect verbosity
author Dan Stowell <danstowell@users.sourceforge.net>
date Wed, 23 Jan 2013 11:36:12 +0000
parents 7d6a647a2d44
children 469e69bdc354
rev   line source
danstowell@5 1
danstowell@5 2 smacpy - simple-minded audio classifier in python
danstowell@5 3 =================================================
danstowell@5 4
danstowell@5 5 Copyright (c) 2012 Dan Stowell and Queen Mary University of London
danstowell@5 6 (incorporating code Copyright (c) 2009 Gyorgy Fazekas and Queen Mary University of London)
danstowell@6 7 - for licence information see the file named COPYING.
danstowell@5 8
danstowell@5 9 This is a classifier that you can train on a set of labelled audio files, and then it predicts a label for further audio files.
danstowell@5 10 It is designed with two main aims:
danstowell@6 11
danstowell@6 12 1. to provide a baseline against which to test more advanced audio classifiers;
danstowell@6 13 2. to provide a simple code example of a classifier which people are free to build on.
danstowell@5 14
danstowell@5 15 It uses the very common workflow of taking audio, converting it frame-by-frame into MFCCs, and modelling the MFCC "bag of frames" with a GMM.
danstowell@5 16
danstowell@5 17 Requirements
danstowell@5 18 ------------
danstowell@7 19 * Python 2.7 or later (it uses the 'argparse' module, not available earlier)
danstowell@5 20 * Python modules:
danstowell@5 21 * numpy
danstowell@20 22 * [scikits.audiolab](http://pypi.python.org/pypi/scikits.audiolab)
danstowell@20 23 * [sckikit-learn](http://scikit-learn.sourceforge.net/)
danstowell@5 24
danstowell@8 25 It has been tested on python 2.7 (on ubuntu 11.10 and 12.04). Not yet tested on python3 but it should be fine...
danstowell@7 26
danstowell@5 27
danstowell@5 28 Usage example 1: commandline
danstowell@5 29 -------------
danstowell@5 30 If you invoke the script from the commandline (e.g. "python smacpy.py") it will assume there is a folder called "wavs"
danstowell@5 31 and inside that folder are multiple WAV files, each of which has an underscore in the filename,
danstowell@5 32 and the class label is the text BEFORE the underscore.
danstowell@19 33 It will train a model using the wavs, and then test it on the same wavs (dividing the collection up so it can do a "crossvalidated" test).
danstowell@5 34
danstowell@7 35 To train and test on different folders, you can run it like this:
danstowell@7 36
danstowell@7 37 python smacpy.py -t trainwavs -T testwavs
danstowell@7 38
danstowell@7 39
danstowell@5 40 Usage example 2: from your own code
danstowell@5 41 -------------
danstowell@5 42 In this hypothetical example we train on four audio files, labelled as either 'usa' or 'uk', and then test on a separate audio file of someone called hubert:
danstowell@5 43
danstowell@5 44 from smacpy import Smacpy
danstowell@5 45 model = Smacpy("wavs/training", {'karen01.wav':'usa', 'john01.wav':'uk', 'steve02.wav':'usa', 'joe03.wav':'uk'})
danstowell@5 46 model.classify('wavs/testing/hubert01.wav')
danstowell@5 47