From 41805575210bd6cc52e739f826114c83554ef03e Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Fri, 9 Aug 2013 14:30:00 -0400 Subject: [PATCH] first pass at evalLandmarking --- openbr/core/eval.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index 05ce85d..c04dfd6 100644 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -16,6 +16,7 @@ #include "bee.h" #include "eval.h" +#include "openbr/core/common.h" #include "openbr/core/qtutils.h" using namespace cv; @@ -478,13 +479,48 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery float EvalLandmarking(const QString &predictedGallery, const QString &truthGallery, const QString &csv, int normalizationIndexA, int normalizationIndexB) { - (void) predictedGallery; - (void) truthGallery; - (void) csv; - (void) normalizationIndexA; - (void) normalizationIndexB; + qDebug("Evaluating landmarking of %s against %s", qPrintable(predictedGallery), qPrintable(truthGallery)); + const TemplateList predicted(TemplateList::fromGallery(predictedGallery)); + const TemplateList truth(TemplateList::fromGallery(truthGallery)); + const QStringList predictedNames = File::get(predicted, "name"); + const QStringList truthNames = File::get(truth, "name"); + + QList< QList > pointErrors; + for (int i=0; i predictedPoints = predicted[i].file.points(); + const QList truthPoints = truth[truthIndex].file.points(); + if (predictedPoints.size() != truthPoints.size()) qFatal("Points size mismatch for file: %s", qPrintable(predictedName)); + while (pointErrors.size() < predictedPoints.size()) + pointErrors.append(QList()); + if (normalizationIndexA >= truthPoints.size()) qFatal("Normalization index A is out of range."); + if (normalizationIndexB >= truthPoints.size()) qFatal("Normalization index B is out of range."); + const float normalizedLength = QtUtils::euclideanLength(truthPoints[normalizationIndexB] - truthPoints[normalizationIndexA]); + for (int j=0; j averagePointErrors; averagePointErrors.reserve(pointErrors.size()); + for (int i=0; i &pointError = pointErrors[i]; + const int keep = qMin(Max_Points, pointError.size()); + for (int j=0; j