Example #1
0
 def testPlot(self):
     roc = pv.ROC(self.match, self.nonmatch, is_distance=True)
     plot = pv.Plot()
     roc.plot(plot, method=ROC_PRECISE_SAMPLED, color="red", width=5)
     roc.plot(plot, method=ROC_PRECISE_ALL, color='black')
     plot.lines([[0, 1], [1, 0]])
     eer = roc.getEER()
     plot.point([eer, 1 - eer])
     plot.asImage()
Example #2
0
    def testFRR(self):
        roc = pv.ROC(self.match,self.nonmatch,is_distance=True)

        result = roc.getFRR(0.5)
        self.assertAlmostEqual(result.far,0.18)
        self.assertAlmostEqual(result.tar,0.50)

        result = roc.getFRR(0.80)
        self.assertAlmostEqual(result.far,0.04)
        self.assertAlmostEqual(result.tar,0.20)
Example #3
0
    def testFAR(self):
        roc = pv.ROC(self.match,self.nonmatch,is_distance=True)

        result = roc.getFAR(0.1)
        self.assertAlmostEqual(result.far,0.1)
        self.assertAlmostEqual(result.tar,0.45)

        result = roc.getFAR(0.01)
        self.assertAlmostEqual(result.far,0.01)
        self.assertAlmostEqual(result.tar,0.15)
Example #4
0
    def getPosNeg(self):
        names = self.srt.getNames()
        pos = []
        neg = []
        for i in range(len(names)):
            for j in range(i + 1, len(names)):
                iname = names[i]
                jname = names[j]
                if self.srt.getRecord(iname).subject_id == self.srt.getRecord(
                        jname).subject_id:
                    pos.append(self.matrix[iname][jname])
                else:
                    neg.append(self.matrix[iname][jname])
        return pos, neg


if __name__ == "__main__":
    srt = CSU_SRT(
        "/Users/bolme/vision/csuFaceIdBenchmark/imagelists/list640.srt")
    ebgm_dist = CSU_Dist(
        "/Users/bolme/vision/csuFaceIdBenchmark/distances/feret/EBGM", srt)
    pca_dist = CSU_Dist(
        "/Users/bolme/vision/csuFaceIdBenchmark/distances/feret/PCA_Euclidean",
        srt)
    ebgm_pos, ebgm_neg = ebgm_dist.getPosNeg()
    pca_pos, pca_neg = pca_dist.getPosNeg()

    from pyvis.analysis.roc import *
    ebgm_roc = pv.ROC(ebgm_pos, ebgm_neg)
    pca_roc = pv.ROC(pca_pos, pca_neg)
Example #5
0
 def testAUC(self):
     roc = pv.ROC(self.match,self.nonmatch,is_distance=True)
     auc = roc.getAUC()
     self.assertAlmostEqual(auc,0.7608)
Example #6
0
    def testEER(self):
        roc = pv.ROC(self.match,self.nonmatch,is_distance=True)

        eer = roc.getEER()
        self.assertAlmostEqual(eer,0.29)