diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index 8c8b70e..1a7159a 100755 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -36,7 +36,12 @@ struct Comparison Comparison() {} Comparison(float _score, int _target, int _query, bool _genuine) : score(_score), target(_target), query(_query), genuine(_genuine) {} - inline bool operator<(const Comparison &other) const { return score > other.score; } + + inline bool operator<(const Comparison &other) const + { + if (score != other.score) return (score > other.score); + else return !genuine; // Tie-break favors pessimistic behavior of ranking impostors higher. + } }; #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 if (impostorCount == 0) qFatal("No impostor scores!"); // Sort comparisons by simmat_val (score) - std::sort(comparisons.begin(), comparisons.end()); + std::stable_sort(comparisons.begin(), comparisons.end()); QList operatingPoints; QList genuines; genuines.reserve(sqrt((float)comparisons.size()));