diff --git a/app/br/br.cpp b/app/br/br.cpp index 507f974..75379cb 100644 --- a/app/br/br.cpp +++ b/app/br/br.cpp @@ -247,7 +247,7 @@ private: "-convert (Format|Gallery|Output) {output_file}\n" "-evalClassification \n" "-evalClustering \n" - "-evalDetection [{csv}]\n" + "-evalDetection [{csv}] [{minSize}]\n" "-evalLandmarking [{csv} [ ]]\n" "-evalRegression \n" "-plotDetection ... {destination}\n" diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index e0c45b2..9879a07 100644 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -820,21 +820,23 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery qDebug("Evaluating detection of %s against %s", qPrintable(predictedGallery), qPrintable(truthGallery)); // Organized by file, QMap used to preserve order QMap allDetections = getDetections(predictedGallery, truthGallery); - + // Remove any bounding boxes with a side smaller than minSize if (minSize > 0) { + qDebug("Removing boxes smaller than %d\n", minSize); foreach(QString key, allDetections.keys()) { - for (int i = 0; i < allDetections[key].predicted.length(); i++) { - QRectF box = allDetections[key].predicted[i].boundingBox; + Detections detections = allDetections[key]; + for (int i = 0; i < detections.predicted.length(); i++) { + QRectF box = detections.predicted[i].boundingBox; if (min(box.width(), box.height()) < minSize) - allDetections[key].predicted.removeAt(i); + detections.predicted.removeAt(i); } - for (int i = 0; i < allDetections[key].truth.length(); i++) { - QRectF box = allDetections[key].truth[i].boundingBox; + for (int i = 0; i < detections.truth.length(); i++) { + QRectF box = detections.truth[i].boundingBox; if (min(box.width(), box.height()) < minSize) - allDetections[key].truth.removeAt(i); + detections.truth.removeAt(i); } - } + } } QList resolvedDetections, falseNegativeDetections; diff --git a/openbr/openbr.h b/openbr/openbr.h index 518303a..dd81b57 100644 --- a/openbr/openbr.h +++ b/openbr/openbr.h @@ -196,7 +196,7 @@ BR_EXPORT void br_eval_clustering(const char *csv, const char *gallery, const ch * \param normalize Optional \c bool flag to normalize predicted bounding boxes for improved detection. * \return Average detection bounding box overlap. */ -BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize); +BR_EXPORT float br_eval_detection(const char *predicted_gallery, const char *truth_gallery, const char *csv = "", bool normalize = false, int minSize = 0); /*! * \brief Evaluates and prints landmarking accuracy to terminal.