diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index c0f7fdd..9f61bf5 100755 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -1035,15 +1035,15 @@ float EvalDetection(const QString &predictedGallery, const QString &truthGallery float EvalLandmarking(const QString &predictedGallery, const QString &truthGallery, const QString &csv, int normalizationIndexA, int normalizationIndexB, int sampleIndex) { 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"); + TemplateList predicted(TemplateList::fromGallery(predictedGallery)); + TemplateList truth(TemplateList::fromGallery(truthGallery)); + QStringList predictedNames = File::get(predicted, "name"); + QStringList truthNames = File::get(truth, "name"); int skipped = 0; QList< QList > pointErrors; + QList imageErrors; QList normalizedLengths; - for (int i=0; i predictedPoints = predicted[i].file.points(); const QList truthPoints = truth[truthIndex].file.points(); if (predictedPoints.size() != truthPoints.size()) { - skipped++; + predicted.removeAt(i); + predictedNames.removeAt(i); + truth.removeAt(i); + truthNames.removeAt(i); + i--; skipped++; continue; } + while (pointErrors.size() < predictedPoints.size()) pointErrors.append(QList()); + // Want to know error for every image. + 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]); normalizedLengths.append(normalizedLength); + float totalError = 0; for (int j=0; j averagePointErrors; averagePointErrors.reserve(pointErrors.size()); - float normalizedErrorLimit = 1.5; - - QSet worstExamples; - for (int i=0; i > exampleIndices = Common::Sort(pointErrors[i],true); - for (int j=0; j > exampleIndices = Common::Sort(imageErrors,true); + + const int totalExamples = 10; + for (int i=0; iexampleIndices.size()-totalExamples-1; i--) { + Enroll(truth[exampleIndices[i].second],"landmarking_examples_truth"); + lines.append("EXT,landmarking_examples_truth/"+truth[exampleIndices[i].second].file.fileName()+","+QString::number(exampleIndices[i].first)); + Enroll(predicted[exampleIndices[i].second],"landmarking_examples_prediced"); + lines.append("EXP,landmarking_examples_prediced/"+predicted[exampleIndices[i].second].file.fileName()+","+QString::number(exampleIndices[i].first)); + + } for (int i=0; i &pointError = pointErrors[i]; const int keep = qMin(Max_Points, pointError.size()); for (int j=0; j