Commit f555c584784e0a3de8c5870f9c696a7c1da52827

Authored by Josh Klontz
1 parent 31e9234b

evalDetection bug fix

Showing 1 changed file with 7 additions and 4 deletions
openbr/core/eval.cpp
... ... @@ -387,7 +387,7 @@ struct DetectionOperatingPoint
387 387 : Recall(TP/totalPositives), FalsePositives(FP), Precision(TP/(TP+FP)) {}
388 388 };
389 389  
390   -static QStringList computeDetectionResults(const QList<ResolvedDetection> &detections, int totalPositives, bool discrete)
  390 +static QStringList computeDetectionResults(const QList<ResolvedDetection> &detections, int totalTrueDetections, bool discrete)
391 391 {
392 392 QList<DetectionOperatingPoint> points;
393 393 float TP = 0, FP = 0, prevFP = -1;
... ... @@ -403,7 +403,7 @@ static QStringList computeDetectionResults(const QList&lt;ResolvedDetection&gt; &amp;detec
403 403 }
404 404 if ((i == detections.size()-1) || (detection.confidence > detections[i+1].confidence)) {
405 405 if (FP > prevFP || (i == detections.size()-1)) {
406   - points.append(DetectionOperatingPoint(TP, FP, totalPositives));
  406 + points.append(DetectionOperatingPoint(TP, FP, totalTrueDetections));
407 407 prevFP = FP;
408 408 }
409 409 }
... ... @@ -507,7 +507,10 @@ float EvalDetection(const QString &amp;predictedGallery, const QString &amp;truthGallery
507 507 QMap<QString, Detections> allDetections = getDetections(predicted, truth);
508 508  
509 509 QList<ResolvedDetection> resolvedDetections, falseNegativeDetections;
  510 + int totalTrueDetections = 0;
510 511 foreach (Detections detections, allDetections.values()) { // For every file
  512 + totalTrueDetections += detections.truth.size();
  513 +
511 514 // Try to associate ground truth detections with predicted detections
512 515 while (!detections.truth.isEmpty() && !detections.predicted.isEmpty()) {
513 516 const Detection truth = detections.truth.takeFirst(); // Take removes the detection
... ... @@ -538,8 +541,8 @@ float EvalDetection(const QString &amp;predictedGallery, const QString &amp;truthGallery
538 541  
539 542 QStringList lines;
540 543 lines.append("Plot, X, Y");
541   - lines.append(computeDetectionResults(resolvedDetections, truth.size(), true));
542   - lines.append(computeDetectionResults(resolvedDetections, truth.size(), false));
  544 + lines.append(computeDetectionResults(resolvedDetections, totalTrueDetections, true));
  545 + lines.append(computeDetectionResults(resolvedDetections, totalTrueDetections, false));
543 546  
544 547 float averageOverlap;
545 548 { // Overlap Density
... ...