Commit bf2208810f1ed47e0804581771e6160d6e8052ab

Authored by Scott Klum
1 parent ef44eed7

Rank output works with crossvalidation

openbr/core/bee.cpp
... ... @@ -102,7 +102,7 @@ void BEE::writeSigset(const QString &sigset, const br::FileList &files, bool ign
102 102 if ((key == "Index") || (key == "Subject")) continue;
103 103 metadata.append(key+"=\""+QtUtils::toString(file.value(key))+"\"");
104 104 }
105   - lines.append("\t<biometric-signature name=\"" + file.get<QString>("Subject", file.name) +"\">");
  105 + lines.append("\t<biometric-signature name=\"" + file.name +"\">");
106 106 lines.append("\t\t<presentation file-name=\"" + file.name + "\" " + metadata.join(" ") + "/>");
107 107 lines.append("\t</biometric-signature>");
108 108 }
... ... @@ -273,6 +273,11 @@ cv::Mat BEE::makeMask(const br::FileList &amp;targets, const br::FileList &amp;queries,
273 273 QList<int> targetPartitions = targets.crossValidationPartitions();
274 274 QList<int> queryPartitions = queries.crossValidationPartitions();
275 275  
  276 + qDebug() << "Targets: " << targetLabels << "\n";
  277 + qDebug() << "Targets: " << targetPartitions << "\n";
  278 + qDebug() << "Queries: " << queryLabels << "\n";
  279 + qDebug() << "Queries: " << queryPartitions << "\n";
  280 +
276 281 Mat mask(queries.size(), targets.size(), CV_8UC1);
277 282 for (int i=0; i<queries.size(); i++) {
278 283 const QString &fileA = queries[i];
... ... @@ -298,6 +303,8 @@ cv::Mat BEE::makeMask(const br::FileList &amp;targets, const br::FileList &amp;queries,
298 303 }
299 304 }
300 305  
  306 + qDebug() << mask.row(0);
  307 +
301 308 return mask;
302 309 }
303 310  
... ...
openbr/core/eval.cpp
... ... @@ -119,6 +119,9 @@ float Evaluate(const Mat &amp;simmat, const Mat &amp;mask, const QString &amp;csv)
119 119 }
120 120 }
121 121  
  122 + qDebug() << genuineCount;
  123 + qDebug() << impostorCount;
  124 +
122 125 if (numNaNs > 0) qWarning("Encountered %d NaN scores!", numNaNs);
123 126 if (genuineCount == 0) qFatal("No genuine scores!");
124 127 if (impostorCount == 0) qFatal("No impostor scores!");
... ...
openbr/plugins/gallery.cpp
... ... @@ -165,10 +165,13 @@ class EmptyGallery : public Gallery
165 165 templates.append(File(fileName, dir.dirName()));
166 166  
167 167 if (!regexp.isEmpty()) {
168   - const QRegularExpression re(regexp);
169   - for (int i=templates.size()-1; i>=0; i--)
170   - if (!re.match(templates[i].file.suffix()).hasMatch())
  168 + QRegExp re(regexp);
  169 + re.setPatternSyntax(QRegExp::Wildcard);
  170 + for (int i=templates.size()-1; i>=0; i--) {
  171 + if (!re.exactMatch(templates[i].file.suffix())) {
171 172 templates.removeAt(i);
  173 + }
  174 + }
172 175 }
173 176  
174 177 return templates;
... ...
openbr/plugins/landmarks.cpp
... ... @@ -231,7 +231,6 @@ class DelaunayTransform : public UntrainableTransform
231 231 QList<Point2f> mappedPoints;
232 232  
233 233 dst.file = src.file;
234   - qDebug() << dst.file.name;
235 234  
236 235 for (int i = 0; i < validTriangles.size(); i++) {
237 236 Eigen::MatrixXf srcMat(validTriangles[i].size(), 2);
... ... @@ -289,8 +288,8 @@ class DelaunayTransform : public UntrainableTransform
289 288 }
290 289  
291 290 // Overwrite any rects
292   - //Rect boundingBox = boundingRect(mappedPoints.toVector().toStdVector());
293   - //dst.file.setRects(QList<QRectF>() << OpenCVUtils::fromRect(boundingBox));
  291 + Rect boundingBox = boundingRect(mappedPoints.toVector().toStdVector());
  292 + dst.file.setRects(QList<QRectF>() << OpenCVUtils::fromRect(boundingBox));
294 293 }
295 294 }
296 295  
... ...
openbr/plugins/output.cpp
... ... @@ -98,7 +98,7 @@ class heatOutput : public MatrixOutput
98 98 {
99 99 Q_OBJECT
100 100 Q_PROPERTY(int patches READ get_patches WRITE set_patches RESET reset_patches STORED false)
101   - BR_PROPERTY(int, patches, -1);
  101 + BR_PROPERTY(int, patches, -1)
102 102  
103 103 ~heatOutput()
104 104 {
... ... @@ -426,13 +426,17 @@ class rankOutput : public MatrixOutput
426 426 typedef QPair<float,int> Pair;
427 427 int rank = 1;
428 428 foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector<float>(data.row(i)), true)) {
429   - if (targetFiles[pair.second].get<QString>("Subject") == queryFiles[i].get<QString>("Subject")) {
430   - ranks.append(rank);
431   - positions.append(pair.second);
432   - scores.append(pair.first);
433   - break;
  429 + if (Globals->crossValidate > 0 ? (targetFiles[pair.second].get<int>("Partition",-1) == queryFiles[i].get<int>("Partition",-1)) : true) {
  430 + if (QString(targetFiles[pair.second]) != QString(queryFiles[i])) {
  431 + if (targetFiles[pair.second].get<QString>("Subject") == queryFiles[i].get<QString>("Subject")) {
  432 + ranks.append(rank);
  433 + positions.append(pair.second);
  434 + scores.append(pair.first);
  435 + break;
  436 + }
  437 + rank++;
  438 + }
434 439 }
435   - rank++;
436 440 }
437 441 }
438 442  
... ...