Example #1
0
def loadDataSet():
    '''this loads the dataset with the genre information put inside'''

    ds = DataSet()
    try:
        ds.load(join(datadir, 'dataset_small.db'))
    except Exception as e:
        print('Error:', str(e))
        print(
            'You should first run the unittests to generate the dataset_small.db file before'
        )
        print('trying to run this example.')
        sys.exit(1)

    genreMap = utils.getClassMapFromDirectory(join(datadir, 'dataset_small'))

    # transform the dataset to add the genre information
    ds = transform(ds, 'addfield', {'string': 'genre'})

    for pid, genre in list(genreMap.items()):
        ds.point(pid).setLabel('genre', genre)

    # we're in a testing environment, prepare the dataset by cleaning it a bit more
    ds = transform(ds, 'removevl')

    # also remove the 'Sample' category, which only contains duplicates and f***s everything up...
    for p in ds.points():
        if p['genre'] == 'Sample':
            ds.removePoint(p.name())

    return ds
Example #2
0
def loadDortmundDataSet():
    try:
        MTGDB = os.environ['MTGDB_AUDIO']
    except KeyError:
        print 'ERROR: the environment variable MTGDB_AUDIO is not defined...'
        print '       You should set it to point to the mount point of the MTGDB audio share.'
        sys.exit(1)

    ds = DataSet()
    ds.load('/tmp/dortmund.db')
    genreMap = utils.getClassMapFromDirectory(
        '%s/benchmarks/genre/Dortmund/descriptors/essentia_streaming_1.0.6_schizo'
        % MTGDB,
        sigfileExtension='.neq.sig')

    # transform the dataset to add the genre information
    ds = transform(ds, 'addfield', {'string': 'genre'})

    for p in ds.points():
        p['genre'] = genreMap[p.name()]

    # we're in a testing environment, prepare the dataset by cleaning it a bit more
    ds = transform(ds, 'removevl')

    return ds
Example #3
0
def loadDataSet():
    '''Load the dataset with the genre information put inside (as the "genre" descriptor).'''
    datadir = join(filedir(), '..', 'unittest', 'data')

    ds = DataSet()
    try:
        ds.load(join(datadir, 'dataset_small.db'))
    except Exception as e:
        print('Error:', str(e))
        print(
            'You should first run the unittests to generate the dataset_small.db file before'
        )
        print('trying to run this example.')
        sys.exit(1)

    genreMap = utils.getClassMapFromDirectory(join(datadir, 'dataset_small'))

    # transform the dataset to add the genre information
    ds = transform(ds, 'addfield', {'string': 'genre'})

    for p in ds.points():
        p['genre'] = genreMap[p.name()]

    # remove the 'Sample' category, which only contains duplicates and f***s everything up...
    ds.collection('dataset_small').removePoints(
        [p.name() for p in ds.points() if p['genre'] == 'Sample'])

    # we're in a testing environment, prepare the dataset by cleaning it a bit more
    ds = transform(ds, 'removevl')

    return ds
Example #4
0
def loadDortmundDataSet():
    try:
        MTGDB = os.environ['MTGDB_AUDIO']
    except KeyError:
        print 'ERROR: the environment variable MTGDB_AUDIO is not defined...'
        print '       You should set it to point to the mount point of the MTGDB audio share.'
        sys.exit(1)

    ds = DataSet()
    ds.load('/tmp/dortmund.db')
    genreMap = utils.getClassMapFromDirectory('%s/benchmarks/genre/Dortmund/descriptors/essentia_streaming_1.0.6_schizo' % MTGDB, sigfileExtension = '.neq.sig')

    # transform the dataset to add the genre information
    ds = transform(ds, 'addfield', { 'string': 'genre' })

    for p in ds.points():
        p['genre'] = genreMap[p.name()]

    # we're in a testing environment, prepare the dataset by cleaning it a bit more
    ds = transform(ds, 'removevl')

    return ds
def loadDataSet():
    '''this loads the dataset with the genre information put inside'''

    basedir = join(filedir(), '..', 'unittest', 'data')

    ds = DataSet()
    try:
        ds.load(join(basedir, 'dataset_small.db'))
    except Exception, e:
        print 'Error:', str(e)
        print 'You should first run the unittests to generate the dataset_small.db file before'
        print 'trying to run this example.'
        sys.exit(1)

    genreMap = utils.getClassMapFromDirectory(join(basedir, 'dataset_small'))

    # transform the dataset to add the genre information
    ds = transform(ds, 'addfield', {'string': 'genre'})

    for pid, genre in genreMap.items():
        ds.point(pid).setLabel('genre', genre)

    # we're in a testing environment, prepare the dataset by cleaning it a bit more
    ds = transform(ds, 'removevl')

    # also remove the 'Sample' category, which only contains duplicates and f***s everything up...
    for p in ds.points():
        if p.label('genre') == 'Sample':
            ds.removePoint(p.name())
Example #6
0

def loadDataSet():
    '''Load the dataset with the genre information put inside (as the "genre" descriptor).'''
    datadir = join(filedir(), '..', 'unittest', 'data')

    ds = DataSet()
    try:
        ds.load(join(datadir, 'dataset_small.db'))
    except Exception, e:
        print 'Error:', str(e)
        print 'You should first run the unittests to generate the dataset_small.db file before'
        print 'trying to run this example.'
        sys.exit(1)

    genreMap = utils.getClassMapFromDirectory(join(datadir, 'dataset_small'))

    # transform the dataset to add the genre information
    ds = transform(ds, 'addfield', { 'string': 'genre' })

    for p in ds.points():
        p['genre'] = genreMap[p.name()]

    # remove the 'Sample' category, which only contains duplicates and f***s everything up...
    ds.collection('dataset_small').removePoints([ p.name() for p in ds.points() if p['genre'] == 'Sample' ])

    # we're in a testing environment, prepare the dataset by cleaning it a bit more
    ds = transform(ds, 'removevl')

    return ds