diff --git a/CMakeLists.txt b/CMakeLists.txt index e66b2f4..52069c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,9 +19,11 @@ set(PACKAGE_YEAR 2013) if(${CMAKE_VERSION} VERSION_EQUAL 2.8.11) cmake_policy(SET CMP0020 OLD) + cmake_policy(SET CMP0022 OLD) endif() if(${CMAKE_VERSION} VERSION_GREATER 2.8.11) cmake_policy(SET CMP0020 OLD) + cmake_policy(SET CMP0022 OLD) endif() if(${CMAKE_SIZEOF_VOID_P} MATCHES 8) diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index 15246cc..d83f8f5 100644 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -394,6 +394,7 @@ static QStringList computeDetectionResults(const QList &detec for (int i=0; i= 0.5) TP++; else FP++; } else { @@ -507,11 +508,13 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery QMap allDetections = getDetections(predicted, truth); QList resolvedDetections, falseNegativeDetections; - foreach (Detections detections, allDetections.values()) { + foreach (Detections detections, allDetections.values()) { // For every file + // Try to associate ground truth detections with predicted detections while (!detections.truth.isEmpty() && !detections.predicted.isEmpty()) { - const Detection truth = detections.truth.takeFirst(); + const Detection truth = detections.truth.takeFirst(); // Take removes the detection int bestIndex = -1; float bestOverlap = -std::numeric_limits::max(); + // Find the nearest predicted detection to this ground truth detection for (int i=0; i bestOverlap) { @@ -519,6 +522,9 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery bestIndex = i; } } + // Removing the detection prevents us from considering it twice. + // We don't want to associate two ground truth detections with the + // same prediction, over vice versa. const Detection predicted = detections.predicted.takeAt(bestIndex); resolvedDetections.append(ResolvedDetection(predicted.confidence, bestOverlap)); } diff --git a/openbr/plugins/meta.cpp b/openbr/plugins/meta.cpp index c713c98..bbf6c68 100644 --- a/openbr/plugins/meta.cpp +++ b/openbr/plugins/meta.cpp @@ -717,6 +717,42 @@ public: }; BR_REGISTER(Transform, DistributeTemplateTransform) +/*! + * \ingroup transforms + * \brief Filters a gallery based on the value of a metadata field. + * \author Brendan Klare \cite bklare + */ +class FilterOnMetadataTransform : public UntrainableMetaTransform +{ + Q_OBJECT + Q_PROPERTY(QString attributeName READ get_attributeName WRITE set_attributeName RESET reset_attributeName STORED false) + Q_PROPERTY(float threshold READ get_threshold WRITE set_threshold RESET reset_threshold STORED false) + Q_PROPERTY(bool isGreaterThan READ get_isGreaterThan WRITE set_isGreaterThan RESET reset_isGreaterThan STORED false) + BR_PROPERTY(QString, attributeName, "Confidence") + BR_PROPERTY(float, threshold, 0) + BR_PROPERTY(bool, isGreaterThan, true) + + void project(const TemplateList &src, TemplateList &dst) const + { + QList