Commit 53366b1a32c92d9fae2216497ad96badb0400b3d
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,7 +36,12 @@ struct Comparison | ||
| 36 | Comparison() {} | 36 | Comparison() {} |
| 37 | Comparison(float _score, int _target, int _query, bool _genuine) | 37 | Comparison(float _score, int _target, int _query, bool _genuine) |
| 38 | : score(_score), target(_target), query(_query), genuine(_genuine) {} | 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 | #undef FAR // Windows preprecessor definition conflicts with variable name | 47 | #undef FAR // Windows preprecessor definition conflicts with variable name |
| @@ -183,7 +188,7 @@ float Evaluate(const Mat &simmat, const Mat &mask, const QString &csv, const QSt | @@ -183,7 +188,7 @@ float Evaluate(const Mat &simmat, const Mat &mask, const QString &csv, const QSt | ||
| 183 | if (impostorCount == 0) qFatal("No impostor scores!"); | 188 | if (impostorCount == 0) qFatal("No impostor scores!"); |
| 184 | 189 | ||
| 185 | // Sort comparisons by simmat_val (score) | 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 | QList<OperatingPoint> operatingPoints; | 193 | QList<OperatingPoint> operatingPoints; |
| 189 | QList<float> genuines; genuines.reserve(sqrt((float)comparisons.size())); | 194 | QList<float> genuines; genuines.reserve(sqrt((float)comparisons.size())); |