Commit 0a0eb914389e192d1a721d8c2270a8257a155572
1 parent
b77220f8
Updated EvalDetection to ignore predicted bounding boxes associated with ground …
…truth boxes that are beyond the specified thresholds
Showing
1 changed file
with
10 additions
and
9 deletions
openbr/core/eval.cpp
| @@ -970,9 +970,10 @@ static int associateGroundTruthDetections(QList<ResolvedDetection> &resolved, QL | @@ -970,9 +970,10 @@ static int associateGroundTruthDetections(QList<ResolvedDetection> &resolved, QL | ||
| 970 | int count = 0, totalTrueDetections = 0; | 970 | int count = 0, totalTrueDetections = 0; |
| 971 | 971 | ||
| 972 | foreach (Detections detections, all.values()) { | 972 | foreach (Detections detections, all.values()) { |
| 973 | - totalTrueDetections += detections.truth.size(); | ||
| 974 | - // Try to associate ground truth detections with predicted detections | 973 | + for (int i=0; i<detections.truth.size(); i++) |
| 974 | + if (!detections.truth[i].ignore) totalTrueDetections++; | ||
| 975 | 975 | ||
| 976 | + // Try to associate ground truth detections with predicted detections | ||
| 976 | QList<SortedDetection> sortedDetections; sortedDetections.reserve(detections.truth.size() * detections.predicted.size()); | 977 | QList<SortedDetection> sortedDetections; sortedDetections.reserve(detections.truth.size() * detections.predicted.size()); |
| 977 | for (int t = 0; t < detections.truth.size(); t++) { | 978 | for (int t = 0; t < detections.truth.size(); t++) { |
| 978 | const Detection truth = detections.truth[t]; | 979 | const Detection truth = detections.truth[t]; |
| @@ -1062,12 +1063,12 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery | @@ -1062,12 +1063,12 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery | ||
| 1062 | filteredDetections.predicted.append(detections.predicted[i]); | 1063 | filteredDetections.predicted.append(detections.predicted[i]); |
| 1063 | } | 1064 | } |
| 1064 | } | 1065 | } |
| 1065 | - | 1066 | + |
| 1066 | for (int i = 0; i < detections.truth.size(); i++) { | 1067 | for (int i = 0; i < detections.truth.size(); i++) { |
| 1067 | QRectF box = detections.truth[i].boundingBox; | 1068 | QRectF box = detections.truth[i].boundingBox; |
| 1068 | - if (min(box.width(), box.height()) > minSize) { | ||
| 1069 | - filteredDetections.truth.append(detections.truth[i]); | ||
| 1070 | - } | 1069 | + if (min(box.width(), box.height()) < minSize) |
| 1070 | + detections.truth[i].ignore = true; | ||
| 1071 | + filteredDetections.truth.append(detections.truth[i]); | ||
| 1071 | } | 1072 | } |
| 1072 | if (!filteredDetections.truth.empty()) allFilteredDetections[key] = filteredDetections; | 1073 | if (!filteredDetections.truth.empty()) allFilteredDetections[key] = filteredDetections; |
| 1073 | } | 1074 | } |
| @@ -1090,9 +1091,9 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery | @@ -1090,9 +1091,9 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery | ||
| 1090 | 1091 | ||
| 1091 | for (int i = 0; i < detections.truth.size(); i++) { | 1092 | for (int i = 0; i < detections.truth.size(); i++) { |
| 1092 | QRectF box = detections.truth[i].boundingBox; | 1093 | QRectF box = detections.truth[i].boundingBox; |
| 1093 | - if (min(box.width(), box.height()) < maxSize) { | ||
| 1094 | - filteredDetections.truth.append(detections.truth[i]); | ||
| 1095 | - } | 1094 | + if (min(box.width(), box.height()) > maxSize) |
| 1095 | + detections.truth[i].ignore = true; | ||
| 1096 | + filteredDetections.truth.append(detections.truth[i]); | ||
| 1096 | } | 1097 | } |
| 1097 | if (!filteredDetections.truth.empty()) allFilteredDetections[key] = filteredDetections; | 1098 | if (!filteredDetections.truth.empty()) allFilteredDetections[key] = filteredDetections; |
| 1098 | } | 1099 | } |