Example #1
0
def testMemleak():
    c = Cyclops('localhost:8090')
    for i in range(100000):
        print i,
        list(c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3",
                            'ds', { 'distance': 'euclidean',
                                    'params': { 'descriptorNames': '*.mean' }}).get(10))
Example #2
0
def testIdOrExample():
    c = Cyclops('localhost:8090')

    assertEqual('BY ID',
                cyc2py(c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3",
                                      'ds', 'euc2').get(10)),
                'BY EXAMPLE',
                cyc2py(c.nnSearchByExample(c.getPoint('ds', "(Sittin' On) The Dock Of The Bay.mp3"),
                                           'ds', 'euc2').get(10)))
Example #3
0
def setup():
    c = Cyclops('localhost:8090')

    c.load('ds', '/tmp/cyclops_unittest.db')

    c.createDistance('euc', 'ds', 'euclidean')
    c.createDistance('euc2', 'ds', 'euclidean', {'descriptorNames': '*.mean'})

    print 'datasets loaded:', c.datasetNames()
    print 'distances created:', c.distanceNames()
Example #4
0
def testMemleak():
    c = Cyclops('localhost:8090')
    for i in range(100000):
        print i,
        list(
            c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3", 'ds', {
                'distance': 'euclidean',
                'params': {
                    'descriptorNames': '*.mean'
                }
            }).get(10))
Example #5
0
def testIdOrExample():
    c = Cyclops('localhost:8090')

    assertEqual(
        'BY ID',
        cyc2py(
            c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3", 'ds',
                           'euc2').get(10)), 'BY EXAMPLE',
        cyc2py(
            c.nnSearchByExample(
                c.getPoint('ds', "(Sittin' On) The Dock Of The Bay.mp3"), 'ds',
                'euc2').get(10)))
Example #6
0
def setup():
    c = Cyclops('localhost:8090')

    c.load('ds', '/tmp/cyclops_unittest.db')

    c.createDistance('euc', 'ds', 'euclidean')
    c.createDistance('euc2', 'ds', 'euclidean', { 'descriptorNames': '*.mean' })

    print 'datasets loaded:', c.datasetNames()
    print 'distances created:', c.distanceNames()
Example #7
0
def testNoCrashInvalidArguments():
    c = Cyclops('localhost:8090')

    try:
        c.getPoints(['ds', 'gloup'])
    except:
        pass

    try:
        c.nnSearchById(['ds', 'gloup'])
    except:
        pass

    try:
        print(
            list(
                c.nnSearchById(
                    "gloup.mp3", 'ds', {
                        'distance': 'euclidean',
                        'params': {
                            'descriptorNames': '*.mean'
                        }
                    }).get(10, keys=['tempotap_bpm'])))
    except:
        pass
Example #8
0
def testRegression():
    c = Cyclops('localhost:8090')

    ds = DataSet()
    ds.load('/tmp/cyclops_unittest.db')

    euc = MetricFactory.create('euclidean', ds.layout())
    euc2 = MetricFactory.create('euclidean', ds.layout(),
                                {'descriptorNames': '*.mean'})

    v = View(ds)

    assertEqual(
        'CYCLOPS',
        cyc2py(
            c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3", 'ds', {
                'distance': 'euclidean',
                'params': {
                    'descriptorNames': '*.mean'
                }
            }).get(10)), 'GAIA2PY',
        v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10))

    assertEqual(
        'CYCLOPS',
        cyc2py(
            c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3", 'ds', {
                'distance': 'euclidean',
                'params': {
                    'descriptorNames': '*.mean'
                }
            }).get(10, 10)), 'GAIA2PY',
        v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10, 10))

    assertEqual(
        'CYCLOPS',
        cyc2py(
            c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3", 'ds', {
                'distance': 'euclidean',
                'params': {
                    'descriptorNames': '*.mean'
                }
            }).get(10, 20)), 'GAIA2PY',
        v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10, 20))

    assertEqual(
        'CYCLOPS BYEX',
        cyc2py(
            c.nnSearchByExample(
                c.getPoint('ds', "(Sittin' On) The Dock Of The Bay.mp3"), 'ds',
                {
                    'distance': 'euclidean',
                    'params': {
                        'descriptorNames': '*.mean'
                    }
                }).get(10, 20)), 'GAIA2PY',
        v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10, 20))
Example #9
0
def testRegression():
    c = Cyclops('localhost:8090')

    ds = DataSet()
    ds.load('/tmp/cyclops_unittest.db')

    euc = MetricFactory.create('euclidean', ds.layout())
    euc2 = MetricFactory.create('euclidean', ds.layout(), { 'descriptorNames': '*.mean' })

    v = View(ds)

    assertEqual('CYCLOPS',
                cyc2py(c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3",
                                      'ds', { 'distance': 'euclidean', 'params': { 'descriptorNames': '*.mean' }}).get(10)),
                'GAIA2PY',
                v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10))

    assertEqual('CYCLOPS',
                cyc2py(c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3",
                                      'ds', { 'distance': 'euclidean', 'params': { 'descriptorNames': '*.mean' }}).get(10, 10)),
                'GAIA2PY',
                v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10, 10))

    assertEqual('CYCLOPS',
                cyc2py(c.nnSearchById("(Sittin' On) The Dock Of The Bay.mp3",
                                      'ds', { 'distance': 'euclidean', 'params': { 'descriptorNames': '*.mean' }}).get(10, 20)),
                'GAIA2PY',
                v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10, 20))


    assertEqual('CYCLOPS BYEX',
                cyc2py(c.nnSearchByExample(c.getPoint('ds', "(Sittin' On) The Dock Of The Bay.mp3"),
                                      'ds', { 'distance': 'euclidean', 'params': { 'descriptorNames': '*.mean' }}).get(10, 20)),
                'GAIA2PY',
                v.nnSearch("(Sittin' On) The Dock Of The Bay.mp3", euc2).get(10, 20))
Example #10
0
def testNoCrashInvalidArguments():
    c = Cyclops('localhost:8090')

    try: c.getPoints([ 'ds', 'gloup' ])
    except: pass

    try: c.nnSearchById([ 'ds', 'gloup' ])
    except: pass

    try:
        print list(c.nnSearchById("gloup.mp3",
                                  'ds', { 'distance': 'euclidean',
                                          'params': { 'descriptorNames': '*.mean' }}).get(10, keys = [ 'tempotap_bpm' ]))
    except:
        pass