Skip to content

Commit

Permalink
Check for NaNs
Browse files Browse the repository at this point in the history
  • Loading branch information
bhklein committed Nov 28, 2023
1 parent 61a157b commit 2efac4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openbr/core/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ float InplaceEval(const QString &simmat, const QString &mask, const QString &csv
qFatal("Simmat and Mask size mismatch!");

// DET stats
size_t genuineCount(0), impostorCount(0);
size_t genuineCount(0), impostorCount(0), numNaNs(0);
QHash<float, Counter> stats;

// IET stats
Expand Down Expand Up @@ -533,6 +533,7 @@ float InplaceEval(const QString &simmat, const QString &mask, const QString &csv
const BEE::SimmatValue sim_val = simmatRow.at<BEE::SimmatValue>(0, j);
const BEE::MaskValue mask_val = maskRow.at<BEE::MaskValue>(0, j);
if (mask_val == BEE::DontCare) continue;
if (sim_val != sim_val) { numNaNs++; continue; }

const bool genuine = (mask_val == BEE::Match);
if (genuine) {
Expand Down Expand Up @@ -567,6 +568,10 @@ float InplaceEval(const QString &simmat, const QString &mask, const QString &csv
}
}

if (numNaNs > 0) qWarning("Encountered %ld NaN scores!", numNaNs);
if (genuineCount == 0) qFatal("No genuine scores!");
if (impostorCount == 0) qFatal("No impostor scores!");

// Write Metadata table
QStringList lines;
lines.append("Plot,X,Y");
Expand Down

0 comments on commit 2efac4c

Please sign in to comment.