Commit 50975d83aa9ed0f94509f45c2f6a743078723f5a

Authored by root
Committed by Jordan Cheney
1 parent 7f645e54

Change filter to minSize and brought up-to-date with master

app/br/br.cpp
... ... @@ -144,8 +144,8 @@ public:
144 144 check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'evalClustering'.");
145 145 br_eval_clustering(parv[0], parv[1], parc == 3 ? parv[2] : "");
146 146 } else if (!strcmp(fun, "evalDetection")) {
147   - check((parc >= 2) && (parc <= 4), "Incorrect parameter count for 'evalDetection'.");
148   - br_eval_detection(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc == 4 ? atoi(parv[3]) : 0);
  147 + check((parc >= 2) && (parc <= 5), "Incorrect parameter count for 'evalDetection'.");
  148 + br_eval_detection(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc == 5 ? atoi(parv[4]) : 0);
149 149 } else if (!strcmp(fun, "evalLandmarking")) {
150 150 check((parc >= 2) && (parc <= 5), "Incorrect parameter count for 'evalLandmarking'.");
151 151 br_eval_landmarking(parv[0], parv[1], parc >= 3 ? parv[2] : "", parc >= 4 ? atoi(parv[3]) : 0, parc >= 5 ? atoi(parv[4]) : 1);
... ...
openbr/core/eval.cpp
... ... @@ -815,11 +815,27 @@ static int associateGroundTruthDetections(QList&lt;ResolvedDetection&gt; &amp;resolved, QL
815 815 return totalTrueDetections;
816 816 }
817 817  
818   -float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv, bool normalize)
  818 +float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv, bool normalize, int minSize)
819 819 {
820 820 qDebug("Evaluating detection of %s against %s", qPrintable(predictedGallery), qPrintable(truthGallery));
821 821 // Organized by file, QMap used to preserve order
822 822 QMap<QString, Detections> allDetections = getDetections(predictedGallery, truthGallery);
  823 +
  824 + // Remove any bounding boxes with a side smaller than minSize
  825 + if (minSize > 0) {
  826 + foreach(QString key, allDetections.keys()) {
  827 + for (int i = 0; i < allDetections[key].predicted.length(); i++) {
  828 + QRectF box = allDetections[key].predicted[i].boundingBox;
  829 + if (min(box.width(), box.height()) < minSize)
  830 + allDetections[key].predicted.removeAt(i);
  831 + }
  832 + for (int i = 0; i < allDetections[key].truth.length(); i++) {
  833 + QRectF box = allDetections[key].truth[i].boundingBox;
  834 + if (min(box.width(), box.height()) < minSize)
  835 + allDetections[key].truth.removeAt(i);
  836 + }
  837 + }
  838 + }
823 839  
824 840 QList<ResolvedDetection> resolvedDetections, falseNegativeDetections;
825 841 QRectF normalizations(0, 0, 0, 0);
... ...
openbr/core/eval.h
... ... @@ -29,7 +29,7 @@ namespace br
29 29 float InplaceEval(const QString & simmat, const QString & target, const QString & query, const QString & csv = "");
30 30  
31 31 void EvalClassification(const QString &predictedGallery, const QString &truthGallery, QString predictedProperty = "", QString truthProperty = "");
32   - float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", bool normalize = false); // Return average overlap
  32 + float EvalDetection(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", bool normalize = false, int minSize = 0); // Return average overlap
33 33 float EvalLandmarking(const QString &predictedGallery, const QString &truthGallery, const QString &csv = "", int normalizationIndexA = 0, int normalizationIndexB = 1); // Return average error
34 34 void EvalRegression(const QString &predictedGallery, const QString &truthGallery, QString predictedProperty = "", QString truthProperty = "");
35 35 }
... ...
openbr/openbr.cpp
... ... @@ -124,9 +124,9 @@ void br_eval_clustering(const char *csv, const char *gallery, const char *truth_
124 124 EvalClustering(csv, gallery, truth_property);
125 125 }
126 126  
127   -float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv, bool normalize)
  127 +float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv, bool normalize, int minSize)
128 128 {
129   - return EvalDetection(predicted_gallery, truth_gallery, csv, normalize);
  129 + return EvalDetection(predicted_gallery, truth_gallery, csv, normalize, minSize);
130 130 }
131 131  
132 132 float br_eval_landmarking(const char *predicted_gallery, const char *truth_gallery, const char *csv, int normalization_index_a, int normalization_index_b)
... ...
openbr/openbr.h
... ... @@ -196,7 +196,7 @@ BR_EXPORT void br_eval_clustering(const char *csv, const char *gallery, const ch
196 196 * \param normalize Optional \c bool flag to normalize predicted bounding boxes for improved detection.
197 197 * \return Average detection bounding box overlap.
198 198 */
199   -BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false);
  199 +BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize);
200 200  
201 201 /*!
202 202 * \brief Evaluates and prints landmarking accuracy to terminal.
... ...