Commit 74762655ddd9047526074166dba6542d5ef0e31b
1 parent
6fa0811d
Fixed bug in evalDetection filtering
Showing
1 changed file
with
12 additions
and
7 deletions
openbr/core/eval.cpp
| ... | ... | @@ -824,18 +824,23 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery |
| 824 | 824 | // Remove any bounding boxes with a side smaller than minSize |
| 825 | 825 | if (minSize > 0) { |
| 826 | 826 | qDebug("Removing boxes smaller than %d\n", minSize); |
| 827 | - foreach(QString key, allDetections.keys()) { | |
| 827 | + foreach (QString key, allDetections.keys()) { | |
| 828 | 828 | Detections detections = allDetections[key]; |
| 829 | - for (int i = 0; i < detections.predicted.length(); i++) { | |
| 829 | + Detections filteredDetections; | |
| 830 | + for (int i = 0; i < detections.predicted.size(); i++) { | |
| 830 | 831 | QRectF box = detections.predicted[i].boundingBox; |
| 831 | - if (min(box.width(), box.height()) < minSize) | |
| 832 | - detections.predicted.removeAt(i); | |
| 832 | + if (min(box.width(), box.height()) > minSize) { | |
| 833 | + filteredDetections.predicted.append(detections.predicted[i]); | |
| 834 | + } | |
| 833 | 835 | } |
| 834 | - for (int i = 0; i < detections.truth.length(); i++) { | |
| 836 | + | |
| 837 | + for (int i = 0; i < detections.truth.size(); i++) { | |
| 835 | 838 | QRectF box = detections.truth[i].boundingBox; |
| 836 | - if (min(box.width(), box.height()) < minSize) | |
| 837 | - detections.truth.removeAt(i); | |
| 839 | + if (min(box.width(), box.height()) > minSize) { | |
| 840 | + filteredDetections.truth.append(detections.truth[i]); | |
| 841 | + } | |
| 838 | 842 | } |
| 843 | + allDetections.insert(key, filteredDetections); | |
| 839 | 844 | } |
| 840 | 845 | } |
| 841 | 846 | ... | ... |