Commit 51b329d64e18ee36f3bfd43ad3039b50ce42b36d
1 parent
4bf65682
Fixed up some old debugs, added some comments
Showing
7 changed files
with
9 additions
and
15 deletions
openbr/core/core.cpp
| @@ -41,7 +41,6 @@ struct AlgorithmCore | @@ -41,7 +41,6 @@ struct AlgorithmCore | ||
| 41 | 41 | ||
| 42 | void train(const File &input, const QString &model) | 42 | void train(const File &input, const QString &model) |
| 43 | { | 43 | { |
| 44 | - qDebug() << input; | ||
| 45 | TemplateList data(TemplateList::fromGallery(input)); | 44 | TemplateList data(TemplateList::fromGallery(input)); |
| 46 | 45 | ||
| 47 | if (transform.isNull()) qFatal("Null transform."); | 46 | if (transform.isNull()) qFatal("Null transform."); |
openbr/openbr_plugin.cpp
| @@ -390,12 +390,12 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) | @@ -390,12 +390,12 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) | ||
| 390 | if (gallery.getBool("leaveOneOut")) { | 390 | if (gallery.getBool("leaveOneOut")) { |
| 391 | QStringList subjects; | 391 | QStringList subjects; |
| 392 | for (int i = 0; i < newTemplates.size(); i++) { | 392 | for (int i = 0; i < newTemplates.size(); i++) { |
| 393 | - QString subject = newTemplates.at(i).file.get<QString>("Subject"); | 393 | + QString subject = newTemplates.at(i).file.get<QString>("Label"); |
| 394 | // Have we seen this subject before? | 394 | // Have we seen this subject before? |
| 395 | if (subjects.contains(subject)) { | 395 | if (subjects.contains(subject)) { |
| 396 | subjects.append(subject); | 396 | subjects.append(subject); |
| 397 | // Get indices belonging to this subject | 397 | // Get indices belonging to this subject |
| 398 | - QList<int> subjectIndices = newTemplates.find("Subject",subject); | 398 | + QList<int> subjectIndices = newTemplates.find("Label",subject); |
| 399 | for (int j = 0; j < subjectIndices.size(); j++) { | 399 | for (int j = 0; j < subjectIndices.size(); j++) { |
| 400 | // Set subject partitions | 400 | // Set subject partitions |
| 401 | newTemplates[subjectIndices[j]].file.set("Partition",j); | 401 | newTemplates[subjectIndices[j]].file.set("Partition",j); |
openbr/plugins/cascade.cpp
| @@ -84,7 +84,6 @@ class CascadeTransform : public UntrainableMetaTransform | @@ -84,7 +84,6 @@ class CascadeTransform : public UntrainableMetaTransform | ||
| 84 | foreach (const Template &t, src) { | 84 | foreach (const Template &t, src) { |
| 85 | const bool enrollAll = t.file.getBool("enrollAll"); | 85 | const bool enrollAll = t.file.getBool("enrollAll"); |
| 86 | 86 | ||
| 87 | - qDebug() << enrollAll; | ||
| 88 | for (int i=0; i<t.size(); i++) { | 87 | for (int i=0; i<t.size(); i++) { |
| 89 | const Mat &m = t[i]; | 88 | const Mat &m = t[i]; |
| 90 | vector<Rect> rects; | 89 | vector<Rect> rects; |
openbr/plugins/eyes.cpp
| @@ -182,8 +182,8 @@ private: | @@ -182,8 +182,8 @@ private: | ||
| 182 | float second_eye_y = (right_rect.y + maxLoc.y)*gray.rows/height+roi.y; | 182 | float second_eye_y = (right_rect.y + maxLoc.y)*gray.rows/height+roi.y; |
| 183 | 183 | ||
| 184 | dst.m() = src.m(); | 184 | dst.m() = src.m(); |
| 185 | - //dst.file.appendPoint(QPointF(first_eye_x, first_eye_y)); | ||
| 186 | - //dst.file.appendPoint(QPointF(second_eye_x, second_eye_y)); | 185 | + dst.file.appendPoint(QPointF(first_eye_x, first_eye_y)); |
| 186 | + dst.file.appendPoint(QPointF(second_eye_x, second_eye_y)); | ||
| 187 | dst.file.set("First_Eye", QPointF(first_eye_x, first_eye_y)); | 187 | dst.file.set("First_Eye", QPointF(first_eye_x, first_eye_y)); |
| 188 | dst.file.set("Second_Eye", QPointF(second_eye_x, second_eye_y)); | 188 | dst.file.set("Second_Eye", QPointF(second_eye_x, second_eye_y)); |
| 189 | } | 189 | } |
openbr/plugins/landmarks.cpp
| @@ -313,7 +313,8 @@ class LoadLandmarksTransform : public UntrainableTransform | @@ -313,7 +313,8 @@ class LoadLandmarksTransform : public UntrainableTransform | ||
| 313 | { | 313 | { |
| 314 | dst = src; | 314 | dst = src; |
| 315 | 315 | ||
| 316 | - QString path = Globals->path + "/" + src.file.baseName() + ".dat"; | 316 | + // Assume the fiduciary file has the same basename as src |
| 317 | + QString path = filePath + "/" + src.file.baseName() + ".dat"; | ||
| 317 | 318 | ||
| 318 | QFile f(path); | 319 | QFile f(path); |
| 319 | if (!f.open(QIODevice::ReadOnly)) qFatal("Unable to open %s for reading.", qPrintable(path)); | 320 | if (!f.open(QIODevice::ReadOnly)) qFatal("Unable to open %s for reading.", qPrintable(path)); |
| @@ -329,6 +330,8 @@ class LoadLandmarksTransform : public UntrainableTransform | @@ -329,6 +330,8 @@ class LoadLandmarksTransform : public UntrainableTransform | ||
| 329 | } | 330 | } |
| 330 | } | 331 | } |
| 331 | 332 | ||
| 333 | + if (landmarks.size() < 35) qFatal("Unrecognized landmark set format."); | ||
| 334 | + | ||
| 332 | dst.file.set("rightEye", landmarks[16]); | 335 | dst.file.set("rightEye", landmarks[16]); |
| 333 | dst.file.set("leftEye", landmarks[18]); | 336 | dst.file.set("leftEye", landmarks[18]); |
| 334 | 337 |
openbr/plugins/output.cpp
| @@ -365,12 +365,9 @@ class evalOutput : public MatrixOutput | @@ -365,12 +365,9 @@ class evalOutput : public MatrixOutput | ||
| 365 | 365 | ||
| 366 | ~evalOutput() | 366 | ~evalOutput() |
| 367 | { | 367 | { |
| 368 | - qDebug() << "here"; | ||
| 369 | - | ||
| 370 | if (data.data) { | 368 | if (data.data) { |
| 371 | const QString csv = QString(file.name).replace(".eval", ".csv"); | 369 | const QString csv = QString(file.name).replace(".eval", ".csv"); |
| 372 | if ((Globals->crossValidate == 0) || (!crossValidate)) { | 370 | if ((Globals->crossValidate == 0) || (!crossValidate)) { |
| 373 | - qDebug() << "here"; | ||
| 374 | Evaluate(data, BEE::makeMask(targetFiles, queryFiles), csv); | 371 | Evaluate(data, BEE::makeMask(targetFiles, queryFiles), csv); |
| 375 | } else { | 372 | } else { |
| 376 | QFutureSynchronizer<float> futures; | 373 | QFutureSynchronizer<float> futures; |
openbr/plugins/validate.cpp
| @@ -52,11 +52,7 @@ class CrossValidateTransform : public MetaTransform | @@ -52,11 +52,7 @@ class CrossValidateTransform : public MetaTransform | ||
| 52 | // even if the partitions are different | 52 | // even if the partitions are different |
| 53 | if (leaveOneOut) { | 53 | if (leaveOneOut) { |
| 54 | QList<int> subjectIndices = partitionedData.find("Subject",partitionedData.at(j).file.get<QString>("Subject")); | 54 | QList<int> subjectIndices = partitionedData.find("Subject",partitionedData.at(j).file.get<QString>("Subject")); |
| 55 | - qDebug() << i << subjectIndices.size(); | ||
| 56 | - if (i > subjectIndices.size()) { | ||
| 57 | - qDebug() << i%subjectIndices.size(); | ||
| 58 | - removed.append(subjectIndices[i%subjectIndices.size()]); | ||
| 59 | - } | 55 | + if (i > subjectIndices.size()) removed.append(subjectIndices[i%subjectIndices.size()]); |
| 60 | } else if (partitions[j] == i) | 56 | } else if (partitions[j] == i) |
| 61 | removed.append(j); | 57 | removed.append(j); |
| 62 | typedef QPair<int,int> Pair; | 58 | typedef QPair<int,int> Pair; |