예제 #1
0
'''
Easy!  mini tutorial
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
corpus = easy.openCorpus( "corpus/LabelMeCarsTest.properties" )
categories, lablist = easy.getDataSet( corpus, 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("-----------")

# pick a subset: all license plates
license_plates = categories['license plate']
print("There are {0} license plate labels.".format( len(license_plates) ))

# another subset: all labels starting with "car"
cars = []
for key in categories.keys():
예제 #2
0
Utilize a Corpus of images with full-image labels
matz 6/19/2013
'''

import easy

# uncomment the line below if you want the program to
# pause after large chunks of text output
def wait():
    # raw_input("Press Enter to continue...")
    pass

# Open a corpus that is specified via a "properties" file;
# note that the path is relative to CVAC.DataDir, as always.
# This doesn't do much yet, it just reads the properties file.
corpus1 = easy.openCorpus( "corpus/CvacCorpusTest.properties" )

# Now let's obtain the labels contained in this corpus.  With
# this particular corpus, the labels are only available if the
# image files are local to the CorpusServer, which in this case is
# the default, local server.  More on that in a moment.
# Images will be downloaded automatically if the createMirror flag
# is set, however, a network connection is required.
categories1, lablist1 = easy.getDataSet( corpus1, createMirror=True )
print("=== Corpus 1: ===");
print('Obtained {0} labeled artifact{1} from corpus1 "{2}":'.format(
    len(lablist1), ("s","")[len(lablist1)==1], corpus1.name ));
easy.printCategoryInfo( categories1 )

# Create a list of labelable files under a directory.
lablist2 = easy.getLabelableList( "trainImg" )
예제 #3
0
# Replace the objname with your object's label.  Note that the
# corpus_fname file name is relative to the CVAC_DataDir which
# is set in config.icebox, config.client, and config.service, and
# which defaults to your installation directory /data.
objname = 'windshield'
#objname = 'bookshelfFrontal'
corpus_fname = 'corpus/labelme_'+objname+'.properties'


# 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_fname, corpusServer=cs )
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 )

# if desired, you can draw the images and their annotations,
# one image at a time, at a given maximum size (width, height)
#easy.drawLabelables( lablist, (512, 512) )

print("==== Training runset: ====")
posPurpose = easy.getPurpose('pos')
negPurpose = easy.getPurpose('neg')
trainset = cvac.RunSet()
easy.addToRunSet(trainset, categories[objname], posPurpose);
#trainset = easy.createRunSet( categories, purpose=posPurpose );
예제 #4
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("-----------")

예제 #5
0
Utilize a Corpus of images with full-image labels
matz 6/19/2013
'''

import easy

# uncomment the line below if you want the program to
# pause after large chunks of text output
def wait():
    # raw_input("Press Enter to continue...")
    pass

# Open a corpus that is specified via a "properties" file;
# note that the path is relative to CVAC.DataDir, as always.
# This doesn't do much yet, it just reads the properties file.
corpus1 = easy.openCorpus( "corpus/CvacCorpusTest.properties" )

# Now let's obtain the labels contained in this corpus.  With
# this particular corpus, the labels are only available if the
# image files are local to the CorpusServer, which in this case is
# the default, local server.  More on that in a moment.
# Images will be downloaded automatically if the createMirror flag
# is set, however, a network connection is required.
categories1, lablist1 = easy.getDataSet( corpus1, createMirror=True )
print("=== Corpus 1: ===");
print('Obtained {0} labeled artifact{1} from corpus1 "{2}":'.format(
    len(lablist1), ("s","")[len(lablist1)==1], corpus1.name ));
easy.printCategoryInfo( categories1 )

# Create a corpus that consists of files under a directory.  This
# is at first identical to creating a RunSet from a folder.
예제 #6
0
'''
Easy!  mini tutorial
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
corpus = easy.openCorpus("corpus/LabelMeCarsTest.properties")
categories, lablist = easy.getDataSet(corpus, createMirror=True)
if (len(lablist) == 0):
    print("No labelable objects found for the data set.  Note that\n"
          "the Python implementation of the FileServer currently requires\n"
          "all LabelMe files to be local, rather than on a server.\n"
          "Please either download all image and annotation files first,\n"
          "or run the Java implementation of the FileServer.")
    exit(-1)
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("-----------")
예제 #7
0
파일: demo.py 프로젝트: dexter1691/CVAC
# 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']

#
# Make sure all files in the RunSet are available on the remote site;
예제 #8
0
'''

import easy


# uncomment the line below if you want the program to
# pause after large chunks of text output
def wait():
    # raw_input("Press Enter to continue...")
    pass


# Open a corpus that is specified via a "properties" file;
# note that the path is relative to CVAC.DataDir, as always.
# This doesn't do much yet, it just reads the properties file.
corpus1 = easy.openCorpus("corpus/CvacCorpusTest.properties")

# Now let's obtain the labels contained in this corpus.  With
# this particular corpus, the labels are only available if the
# image files are local to the CorpusServer, which in this case is
# the default, local server.  More on that in a moment.
# Images will be downloaded automatically if the createMirror flag
# is set, however, a network connection is required.
categories1, lablist1 = easy.getDataSet(corpus1, createMirror=True)
print("=== Corpus 1: ===")
print('Obtained {0} labeled artifact{1} from corpus1 "{2}":'.format(
    len(lablist1), ("s", "")[len(lablist1) == 1], corpus1.name))
easy.printCategoryInfo(categories1)

# Create a list of labelable files under a directory.
lablist2 = easy.getLabelableList("trainImg")
예제 #9
0
import cvac

# Replace the objname with your object's label.  Note that the
# corpus_fname file name is relative to the CVAC_DataDir which
# is set in config.icebox, config.client, and config.service, and
# which defaults to your installation directory /data.
objname = 'windshield'
#objname = 'bookshelfFrontal'
corpus_fname = 'corpus/labelme_' + objname + '.properties'

# 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_fname, corpusServer=cs)
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)

# if desired, you can draw the images and their annotations,
# one image at a time, at a given maximum size (width, height)
#easy.drawLabelables( lablist, (512, 512) )

print("==== Training runset: ====")
posPurpose = easy.getPurpose('pos')
negPurpose = easy.getPurpose('neg')
trainset = cvac.RunSet()
easy.addToRunSet(trainset, categories[objname], posPurpose)
#trainset = easy.createRunSet( categories, purpose=posPurpose );