Commit 53366b1a32c92d9fae2216497ad96badb0400b3d

Authored by Josh Klontz
2 parents 6a209461 5a1e0674

Merge branch 'master' of https://github.com/biometrics/openbr

Showing 1 changed file with 7 additions and 2 deletions
openbr/core/eval.cpp
... ... @@ -36,7 +36,12 @@ struct Comparison
36 36 Comparison() {}
37 37 Comparison(float _score, int _target, int _query, bool _genuine)
38 38 : score(_score), target(_target), query(_query), genuine(_genuine) {}
39   - inline bool operator<(const Comparison &other) const { return score > other.score; }
  39 +
  40 + inline bool operator<(const Comparison &other) const
  41 + {
  42 + if (score != other.score) return (score > other.score);
  43 + else return !genuine; // Tie-break favors pessimistic behavior of ranking impostors higher.
  44 + }
40 45 };
41 46  
42 47 #undef FAR // Windows preprecessor definition conflicts with variable name
... ... @@ -183,7 +188,7 @@ float Evaluate(const Mat &amp;simmat, const Mat &amp;mask, const QString &amp;csv, const QSt
183 188 if (impostorCount == 0) qFatal("No impostor scores!");
184 189  
185 190 // Sort comparisons by simmat_val (score)
186   - std::sort(comparisons.begin(), comparisons.end());
  191 + std::stable_sort(comparisons.begin(), comparisons.end());
187 192  
188 193 QList<OperatingPoint> operatingPoints;
189 194 QList<float> genuines; genuines.reserve(sqrt((float)comparisons.size()));
... ...