Commit 02ead89d62b8c84d2908f0865ede07a8e2f6bc1b

Authored by Brendan Klare
1 parent 7f3e4969

Handle non-thresholdable output for detection plotting

Showing 1 changed file with 9 additions and 3 deletions
openbr/core/eval.cpp
... ... @@ -383,13 +383,19 @@ static QStringList computeDetectionResults(const QList<ResolvedDetection> &detec
383 383 }
384 384  
385 385 const int keep = qMin(points.size(), Max_Points);
386   - if (keep < 2) qFatal("Insufficient points.");
  386 + if (keep < 1) qFatal("Insufficient points.");
387 387  
388 388 QStringList lines; lines.reserve(keep);
389   - for (int i=0; i<keep; i++) {
390   - const DetectionOperatingPoint &point = points[double(i) / double(keep-1) * double(points.size()-1)];
  389 + if (keep == 1) {
  390 + const DetectionOperatingPoint &point = points[0];
391 391 lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositives), QString::number(point.Recall)));
392 392 lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision)));
  393 + } else {
  394 + for (int i=0; i<keep; i++) {
  395 + const DetectionOperatingPoint &point = points[double(i) / double(keep-1) * double(points.size()-1)];
  396 + lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositives), QString::number(point.Recall)));
  397 + lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision)));
  398 + }
393 399 }
394 400 return lines;
395 401 }
... ...