Пример #1
0
else:
    c = ev.Contender("DPM")
    c.detectorString = "DPM_Detector"
    c.detectorData = "detectors/dpmStarbucksLogo.zip"
    c.foundMap = {'Positive':easy.getPurpose('pos'), 'Negative':easy.getPurpose('neg')}
    contenders.append( c );

# OpenCVCascade, with special settings for anticipated poor performance
if (easy.getTrainer("OpenCVCascadeTrainer")==None):
    print("Cascade service(s) are insufficiently configured, skipping.")
else:
    c = ev.Contender("cascade")
    c.trainerString = "OpenCVCascadeTrainer"
    c.detectorString = "OpenCVCascadeDetector"
    # c.foundMap = {'any':easy.getPurpose('pos')}
    c.foundMap = {'positive':posPurpose, 'negative':negPurpose}
    detector = easy.getDetector(c.detectorString)
    detectorProps = easy.getDetectorProperties(detector)
    c.detectorProps = detectorProps;
    c.detectorProps.props["maxRectangles"] = "200"
    c.detectorProps.minNeighbors = 0; # This prevents hang up in evaluator when training has too few samples
    contenders.append( c );

runset = easy.createRunSet( "trainImg/kr", "pos" )
easy.addToRunSet( runset, "trainImg/ca", "neg" )
easy.printRunSetInfo( runset, printArtifacts=False, printLabels=True )

perfdata = ev.joust( contenders, runset, folds=3 )
ev.printEvaluationResults(perfdata[0])

    print("BOW detector service is insufficiently configured, skipping.")
else:
    c = ev.Contender("BOW")
    c.detectorString = "BOW_Detector"
    c.detectorData = "detectors/bowUSKOCA.zip"
    c.foundMap = {
        'kr': easy.getPurpose('pos'),
        'ca': easy.getPurpose('neg'),
        'us': easy.getPurpose('neg'),
        'unlabeled': easy.getPurpose('neg')
    }
    contenders.append(c)

# OpenCV Cascade detector
if (easy.getDetector("OpenCVCascadeDetector") == None):
    print(
        "OpenCVCascadeDetector service is insufficiently configured, skipping."
    )
else:
    c = ev.Contender("Faces")
    c.detectorString = "OpenCVCascadeDetector"
    c.detectorData = "detectors/OpencvFaces.zip"
    c.foundMap = {
        'positive': easy.getPurpose('pos'),
        'negative': easy.getPurpose('neg')
    }
    contenders.append(c)

perfdata = ev.joust(contenders, runset)
ev.printEvaluationResults(perfdata[0])
Пример #3
0
    c.detectorData = "detectors/dpmStarbucksLogo.zip"
    c.foundMap = {
        'Positive': easy.getPurpose('pos'),
        'Negative': easy.getPurpose('neg')
    }
    contenders.append(c)

# OpenCVCascade, with special settings for anticipated poor performance
if (easy.getTrainer("OpenCVCascadeTrainer") == None):
    print("Cascade service(s) are insufficiently configured, skipping.")
else:
    c = ev.Contender("cascade")
    c.trainerString = "OpenCVCascadeTrainer"
    c.detectorString = "OpenCVCascadeDetector"
    # c.foundMap = {'any':easy.getPurpose('pos')}
    c.foundMap = {'positive': posPurpose, 'negative': negPurpose}
    detector = easy.getDetector(c.detectorString)
    detectorProps = easy.getDetectorProperties(detector)
    c.detectorProps = detectorProps
    c.detectorProps.props["maxRectangles"] = "200"
    c.detectorProps.minNeighbors = 0
    # This prevents hang up in evaluator when training has too few samples
    contenders.append(c)

runset = easy.createRunSet("trainImg/kr", "pos")
easy.addToRunSet(runset, "trainImg/ca", "neg")
easy.printRunSetInfo(runset, printArtifacts=False, printLabels=True)

perfdata = ev.joust(contenders, runset, folds=3)
ev.printEvaluationResults(perfdata[0])
#easy.printRunSetInfo( runset, printArtifacts=False, printLabels=True )

contenders = []

# Bag of Words
if (easy.getDetector("BOW_Detector")==None):
    print("BOW detector service is insufficiently configured, skipping.")
else:
    c = ev.Contender("BOW")
    c.detectorString = "BOW_Detector"
    c.detectorData = "detectors/bowUSKOCA.zip"
    c.foundMap = { 'kr':easy.getPurpose('pos'),
                   'ca':easy.getPurpose('neg'),
                   'us':easy.getPurpose('neg'),
                   'unlabeled':easy.getPurpose('neg')}
    contenders.append( c );

# OpenCV Cascade detector
if (easy.getDetector("OpenCVCascadeDetector")==None):
    print("OpenCVCascadeDetector service is insufficiently configured, skipping.")
else:
    c = ev.Contender("Faces")
    c.detectorString = "OpenCVCascadeDetector"
    c.detectorData = "detectors/OpencvFaces.zip"
    c.foundMap = { 'positive':easy.getPurpose('pos'),
                   'negative':easy.getPurpose('neg')}
    contenders.append( c );

perfdata = ev.joust( contenders, runset )
ev.printEvaluationResults(perfdata[0])