コード例 #1
0
ファイル: gui.py プロジェクト: permikomnaskaltara/CVAC
 def verifyProxies(self, proxies):
     ''' Take as input dictionary of {name:proxystring} and verify that
         we can communicate with the server (by getting the detector or trainer).
         Return a dictionary with 'detector running' or 'trainer running' if running 
         and 'configured' if not. Also print now so with long config files user
         sees output.
     '''
     res = {}
     for key, value in proxies.iteritems():
         # add short timeout
         value = value + ' -t 100'
         try:
             detector = easy.getDetector(value)
             res[key] = 'detector running'
             print("{0} {1}".format(key, res[key]))
             continue
         except:
             pass
         try:
             trainer = easy.getTrainer(value)
             res[key] = 'trainer running'
             print("{0} {1}".format(key, res[key]))
             continue
         except:
             pass
         try:
             trainer = easy.getFileServer(value)
             res[key] = 'FileServer running'
             print("{0} {1}".format(key, res[key]))
             continue
         except:
             pass
         try:
             trainer = easy.getCorpusServer(value)
             res[key] = 'Corpus running'
             print("{0} {1}".format(key, res[key]))
             continue
         except:
             pass
         res[key] = 'not running'
         print("{0} {1}".format(key, res[key]))
     return res
コード例 #2
0
'''
Easy!  test for corpus_service.py
Obtain labeled data from a LabelMe server.
See http://new-labelme.csail.mit.edu/Release3.0
matz 6/19/2013
'''

import easy

# The properties file for a LabelMe Corpus contains all pertinent information.
# Take a look at corpus/LabelMeCarsTest.properties and pay particular
# attention to the following properties:
# LMFolders and LMObjectNames
cs = easy.getCorpusServer( "PythonCorpusService:default -p 10021")
corpus = easy.openCorpus( "corpus/LabelMeCircuit.properties", corpusServer=cs )
categories, lablist = easy.getDataSet( corpus, corpusServer=cs, 
                                       createMirror=True )
print('Obtained {0} labeled artifact{1} from corpus "{2}":'.format(
    len(lablist), ("s","")[len(lablist)==1], corpus.name ));
easy.printCategoryInfo( categories )

# draw the images and their annotations, one image at a time,
# at a given maximum size (width, height)
easy.drawLabelables( lablist, (512, 512) )
print("-----------")

コード例 #3
0
ファイル: demo.py プロジェクト: dexter1691/CVAC
#
# TODO: currently breaks because Caltech101 doesn't get extracted as expected
#categories, lablist = easy.getDataSet( "corpus/CvacCorpusTest" )
# categories, lablist = easy.getDataSet( "corpus/Caltech101.properties", createMirror=False )
#easy.printCategoryInfo( categories )
#runset = easy.createRunSet( categories["car_side"] )
#trainer = easy.getTrainer( "bowTrain:default -p 10103" )
#carSideModel = easy.train( trainer, runset )

#
# Third, a slower walk-through of functionality that digs a bit deeper.  All
# following steps are part of that.
# Obtain a set of labeled data from a Corpus,
# print dataset information about this corpus
#
cs = easy.getCorpusServer("CorpusServer:default -p 10011")
#corpus = easy.openCorpus( cs, "corpus/CvacCorpusTest.properties" )
#corpus = easy.openCorpus( cs, "corporate_logos" );
corpus = easy.openCorpus( cs, "trainImg" );
categories, lablist = easy.getDataSet( corpus, corpusServer=cs )
print('Obtained {0} labeled artifact{1} from corpus "{2}":'.format(
    len(lablist), ("s","")[len(lablist)==1], corpus.name ));
easy.printCategoryInfo( categories )

#
# add all samples from corpus to a RunSet,
# also obtain a mapping from class ID to label name
#
res = easy.createRunSet( categories )
runset = res['runset']
classmap = res['classmap']