def testMFCC():
    '''Does a simple test by comparing which of MFCC-SG + Kullback-Leibler distance or
    MFCC-mean/var + euclidean distance gives the best results.'''
    ds = loadDataSet()

    ds = utils.addVarFromCov(ds, 'mfcc')

    groundTruth = utils.getGroundTruthFromLabel(ds, 'genre')

    print 'Evaluating 1-NN genre classification using euclidean distance on mfcc.mean and mfcc.var:'
    confusion = nnclassifier.evaluate_1NN(
        ds, groundTruth, 'euclidean',
        {'descriptorNames': ['mfcc.mean', 'mfcc.var']})
    print confusion.results()

    cmfile = join(tempdir, 'confusion_meanvar.html')
    open(cmfile, 'w').write(confusion.toHtml())
    print '(wrote confusion matrix to %s)' % cmfile
    print

    print 'Evaluating 1-NN genre classification using Kullback-Leibler distance on mfcc:'
    confusion = nnclassifier.evaluate_1NN(ds, groundTruth, 'kullbackleibler',
                                          {'descriptorName': 'mfcc'})
    print confusion.results()
    cmfile = join(tempdir, 'confusion_singlegaussian.html')
    open(cmfile, 'w').write(confusion.toHtml())
    print '(wrote confusion matrix to %s)' % cmfile
    print
def testMFCC():
    '''Does a simple test by comparing which of MFCC-SG + Kullback-Leibler distance or
    MFCC-mean/var + euclidean distance gives the best results.'''
    ds = loadDataSet()

    ds = utils.addVarFromCov(ds, 'mfcc')

    groundTruth = utils.getGroundTruthFromLabel(ds, 'genre')


    print 'Evaluating 1-NN genre classification using euclidean distance on mfcc.mean and mfcc.var:'
    confusion = nnclassifier.evaluate_1NN(ds, groundTruth,
                                          'euclidean',
                                          { 'descriptorNames': [ 'mfcc.mean', 'mfcc.var' ] })
    print confusion.results()

    cmfile = join(tempdir, 'confusion_meanvar.html')
    open(cmfile, 'w').write(confusion.toHtml())
    print '(wrote confusion matrix to %s)' % cmfile
    print


    print 'Evaluating 1-NN genre classification using Kullback-Leibler distance on mfcc:'
    confusion = nnclassifier.evaluate_1NN(ds, groundTruth,
                                          'kullbackleibler',
                                          { 'descriptorName': 'mfcc' })
    print confusion.results()
    cmfile = join(tempdir, 'confusion_singlegaussian.html')
    open(cmfile, 'w').write(confusion.toHtml())
    print '(wrote confusion matrix to %s)' % cmfile
    print
Example #3
0

def descnames(config, name):
    dnames = '%s descriptors' % name
    result = config[dnames]
    if config[dnames + ' except']:
        result += ', except %s' % config[dnames + ' except']
    return result


if __name__ == '__main__':
    cvar.verbose = False

    if config['dataset'] == 'dataset':
        ds = loadDataSet()
        ds = utils.addVarFromCov(ds, 'mfcc')

    elif config['dataset'] == 'dortmund':
        ds = loadDortmundDataSet()
        ds = utils.addVarFromCov(ds, 'lowlevel.mfcc')

    else:
        print 'Unknown dataset:', config['dataset']

    groundTruth = utils.getGroundTruthFromLabel(ds, 'genre')

    # NN-classifier: euclidean distance on MFCC mean/var
    if 'baseline' in config['classifiers']:
        print hbar
        print 'Evaluating 1-NN genre classification using euclidean distance on MFCC.mean and MFCC.var:'
Example #4
0

def descnames(config, name):
    dnames = '%s descriptors' % name
    result = config[dnames]
    if config[dnames + ' except']:
        result += ', except %s' % config[dnames + ' except']
    return result


if __name__ == '__main__':
    cvar.verbose = False

    if config['dataset'] == 'dataset':
        ds = loadDataSet()
        ds = utils.addVarFromCov(ds, 'mfcc')

    elif config['dataset'] == 'dortmund':
        ds = loadDortmundDataSet()
        ds = utils.addVarFromCov(ds, 'lowlevel.mfcc')

    else:
        print 'Unknown dataset:', config['dataset']

    groundTruth = utils.getGroundTruthFromLabel(ds, 'genre')

    # NN-classifier: euclidean distance on MFCC mean/var
    if 'baseline' in config['classifiers']:
        print hbar
        print 'Evaluating 1-NN genre classification using euclidean distance on MFCC.mean and MFCC.var:'
        '''