From 6c187349522faa9ae9bf880c4fbc1846318428ce Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Mon, 8 Apr 2013 17:04:48 -0400 Subject: [PATCH] Maybe fixed cross validation bug? --- openbr/core/plot.cpp | 23 ++++++++++++++--------- openbr/openbr_plugin.cpp | 2 ++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/openbr/core/plot.cpp b/openbr/core/plot.cpp index b89706a..e7fa059 100644 --- a/openbr/core/plot.cpp +++ b/openbr/core/plot.cpp @@ -231,19 +231,23 @@ float Evaluate(const Mat &simmat, const Mat &mask, const QString &csv) lines.append(qPrintable(QString("BC,0.001,%1").arg(QString::number(getTAR(operatingPoints, 0.001), 'f', 3)))); lines.append(qPrintable(QString("BC,0.01,%1").arg(QString::number(result = getTAR(operatingPoints, 0.01), 'f', 3)))); + // Write SD & KDE points = qMin(qMin(Max_Points, genuines.size()), impostors.size()); QList sampledGenuineScores; sampledGenuineScores.reserve(points); QList sampledImpostorScores; sampledImpostorScores.reserve(points); - for (int i=0; i::max()) genuineScore = minGenuineScore; - if (impostorScore == -std::numeric_limits::max()) impostorScore = minImpostorScore; - lines.append(QString("SD,%1,Genuine").arg(QString::number(genuineScore))); - lines.append(QString("SD,%1,Impostor").arg(QString::number(impostorScore))); - sampledGenuineScores.append(genuineScore); - sampledImpostorScores.append(impostorScore); + + if (points > 1) { + for (int i=0; i::max()) genuineScore = minGenuineScore; + if (impostorScore == -std::numeric_limits::max()) impostorScore = minImpostorScore; + lines.append(QString("SD,%1,Genuine").arg(QString::number(genuineScore))); + lines.append(QString("SD,%1,Impostor").arg(QString::number(impostorScore))); + sampledGenuineScores.append(genuineScore); + sampledImpostorScores.append(impostorScore); + } } const double hGenuine = Common::KernelDensityBandwidth(sampledGenuineScores); @@ -257,6 +261,7 @@ float Evaluate(const Mat &simmat, const Mat &mask, const QString &csv) // Write Cumulative Match Characteristic (CMC) curve const int Max_Retrieval = 100; const int Report_Retrieval = 5; + float reportRetrievalRate = -1; for (int i=1; i<=Max_Retrieval; i++) { int realizedReturns = 0, possibleReturns = 0; diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 6645796..804c1ee 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -441,6 +441,8 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) newTemplates[i].file.set("Cross_Validation_Partition", QVariant(0)); for (int j=crossValidate-1; j>=1; j--) { Template allPartitionTemplate = newTemplates[i]; + allPartitionTemplate.file.append(gallery.localMetadata()); + allPartitionTemplate.file.append(file.localMetadata()); allPartitionTemplate.file.set("Cross_Validation_Partition", j); allPartitionTemplate.file.set("Label", i+templates.size()); // Insert templates for all the other partitions -- libgit2 0.21.4