From f555c584784e0a3de8c5870f9c696a7c1da52827 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 9 Dec 2013 18:50:01 -0500 Subject: [PATCH] evalDetection bug fix --- openbr/core/eval.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index 9a4da29..97df2e5 100644 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -387,7 +387,7 @@ struct DetectionOperatingPoint : Recall(TP/totalPositives), FalsePositives(FP), Precision(TP/(TP+FP)) {} }; -static QStringList computeDetectionResults(const QList &detections, int totalPositives, bool discrete) +static QStringList computeDetectionResults(const QList &detections, int totalTrueDetections, bool discrete) { QList points; float TP = 0, FP = 0, prevFP = -1; @@ -403,7 +403,7 @@ static QStringList computeDetectionResults(const QList &detec } if ((i == detections.size()-1) || (detection.confidence > detections[i+1].confidence)) { if (FP > prevFP || (i == detections.size()-1)) { - points.append(DetectionOperatingPoint(TP, FP, totalPositives)); + points.append(DetectionOperatingPoint(TP, FP, totalTrueDetections)); prevFP = FP; } } @@ -507,7 +507,10 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery QMap allDetections = getDetections(predicted, truth); QList resolvedDetections, falseNegativeDetections; + int totalTrueDetections = 0; foreach (Detections detections, allDetections.values()) { // For every file + totalTrueDetections += detections.truth.size(); + // Try to associate ground truth detections with predicted detections while (!detections.truth.isEmpty() && !detections.predicted.isEmpty()) { const Detection truth = detections.truth.takeFirst(); // Take removes the detection @@ -538,8 +541,8 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery QStringList lines; lines.append("Plot, X, Y"); - lines.append(computeDetectionResults(resolvedDetections, truth.size(), true)); - lines.append(computeDetectionResults(resolvedDetections, truth.size(), false)); + lines.append(computeDetectionResults(resolvedDetections, totalTrueDetections, true)); + lines.append(computeDetectionResults(resolvedDetections, totalTrueDetections, false)); float averageOverlap; { // Overlap Density -- libgit2 0.21.4