Commit c3f697335533a8588b61ba8002fabfc489072657
1 parent
e4d3f118
handle case where there are no FP
Showing
1 changed file
with
2 additions
and
2 deletions
openbr/core/eval.cpp
| ... | ... | @@ -374,7 +374,7 @@ struct DetectionOperatingPoint |
| 374 | 374 | static QStringList computeDetectionResults(const QList<ResolvedDetection> &detections, int totalPositives, bool discrete) |
| 375 | 375 | { |
| 376 | 376 | QList<DetectionOperatingPoint> points; |
| 377 | - float TP = 0, FP = 0, prevFP = 0; | |
| 377 | + float TP = 0, FP = 0, prevFP = -1; | |
| 378 | 378 | for (int i=0; i<detections.size(); i++) { |
| 379 | 379 | const ResolvedDetection &detection = detections[i]; |
| 380 | 380 | if (discrete) { |
| ... | ... | @@ -385,7 +385,7 @@ static QStringList computeDetectionResults(const QList<ResolvedDetection> &detec |
| 385 | 385 | FP += 1 - detection.overlap; |
| 386 | 386 | } |
| 387 | 387 | if ((i == detections.size()-1) || (detection.confidence > detections[i+1].confidence)) { |
| 388 | - if (FP > prevFP) { | |
| 388 | + if (FP > prevFP || (i == detections.size()-1)) { | |
| 389 | 389 | points.append(DetectionOperatingPoint(TP, FP, totalPositives)); |
| 390 | 390 | prevFP = FP; |
| 391 | 391 | } | ... | ... |