Ejemplo n.º 1
0
 def createSignature(self, a, b):
     s = Signatures()
     s.names = ["ft [0]", "ft [1]"]
     s.values = [a, b]
     s.source_file = "%s %s" % (a, b)
     s.version = self.feature_vector_version
     return s
Ejemplo n.º 2
0
 def createSignature(self, a, b):
     s = Signatures()
     s.names = ['ft [0]', 'ft [1]']
     s.values = [a, b]
     s.source_file = '%s %s' % (a, b)
     s.version = self.feature_vector_version
     return s
Ejemplo n.º 3
0
 def createSignature(self, a, b):
     s = Signatures()
     s.names = ['ft [0]', 'ft [1]']
     s.values = [a, b]
     s.source_file = '%s %s' % (a, b)
     s.version = self.feature_vector_version
     return s
def addToFeatureSet(ftb, ds, fts, classId, imagesOnly):
    message = ''

    tid = WndcharmStorage.getAttachedTableFile(ftb.tc, ds)
    if tid:
        if not ftb.openTable(tid):
            return message + '\nERROR: Table not opened'
        version = unwrap(ftb.versiontag.getTextValue())
        message += 'Opened table id:%d version:%s\n' % (tid, version)
    else:
        message += 'ERROR: Table not found for Dataset id:%d' % ds.getId()
        return message

    if imagesOnly:
        for image in ds.listChildren():
            imId = image.getId()
            message += '\tProcessing features for image id:%d\n' % imId

            sig = Signatures()
            (sig.names, sig.values) = ftb.loadFeatures(imId)
            sig.source_file = str(imId)
            sig.version = version
            fts.AddSignature(sig, classId)

    else:
        names, values, ids = ftb.bulkLoadFeatures()
        message += '\tProcessing all features for dataset id:%d\n' % ds.getId()

        for imId, vals in izip(ids, values):
            sig = Signatures()
            sig.names = names
            sig.values = vals
            sig.source_file = str(imId)
            sig.version = version
            fts.AddSignature(sig, classId)

    fts.classnames_list[classId] = ds.getName()
    return message