Commit cf1ec3997dceccb9678b2d870d13472634d79e2a

Authored by Josh Klontz
1 parent 43585b3f

fixed eval edge case

Showing 1 changed file with 4 additions and 2 deletions
openbr/core/plot.cpp
... ... @@ -101,6 +101,7 @@ static float getTAR(const QList<OperatingPoint> &operatingPoints, float FAR)
101 101 if (index == operatingPoints.size())
102 102 return 1;
103 103 }
  104 +
104 105 const float x1 = (index == 0 ? 0 : operatingPoints[index-1].FAR);
105 106 const float y1 = (index == 0 ? 0 : operatingPoints[index-1].TAR);
106 107 const float x2 = operatingPoints[index].FAR;
... ... @@ -174,7 +175,8 @@ float Evaluate(const Mat &simmat, const Mat &mask, const QString &csv)
174 175 std::sort(comparisons.begin(), comparisons.end());
175 176  
176 177 QList<OperatingPoint> operatingPoints;
177   - QList<float> genuines, impostors;
  178 + QList<float> genuines; genuines.reserve(sqrt(comparisons.size()));
  179 + QList<float> impostors; impostors.reserve(comparisons.size());
178 180 QVector<int> firstGenuineReturns(simmat.rows, 0);
179 181  
180 182 int falsePositives = 0, previousFalsePositives = 0;
... ... @@ -212,7 +214,7 @@ float Evaluate(const Mat &amp;simmat, const Mat &amp;mask, const QString &amp;csv)
212 214 if ((falsePositives > previousFalsePositives) &&
213 215 (truePositives > previousTruePositives)) {
214 216 // Restrict the extreme ends of the curve
215   - if ((falsePositives >= 10) && (falsePositives < impostorCount/2))
  217 + if ((truePositives >= 10) && (falsePositives < impostorCount/2))
216 218 operatingPoints.append(OperatingPoint(thresh, float(falsePositives)/impostorCount, float(truePositives)/genuineCount));
217 219 previousFalsePositives = falsePositives;
218 220 previousTruePositives = truePositives;
... ...