From cb24123a0c45062bcfbe43ea079a0891e9fcc368 Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Thu, 21 May 2015 11:06:09 -0400 Subject: [PATCH] Handling negatives otherwhere --- openbr/core/bee.cpp | 4 ++-- openbr/core/core.cpp | 2 +- openbr/openbr_plugin.cpp | 2 +- openbr/plugins/output/eval.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openbr/core/bee.cpp b/openbr/core/bee.cpp index 2f1e1be..1611ef8 100644 --- a/openbr/core/bee.cpp +++ b/openbr/core/bee.cpp @@ -230,7 +230,7 @@ void makeMask(const QString &targetInput, const QString &queryInput, const QStri const FileList targets = TemplateList::fromGallery(targetInput).files(); const FileList queries = (queryInput == ".") ? targets : TemplateList::fromGallery(queryInput).files(); const int partitions = targets.first().get("crossValidate"); - if (partitions == 0) { + if (partitions <= 0) { writeMatrix(makeMask(targets, queries), mask, targetInput, queryInput); } else { if (!mask.contains("%1")) qFatal("Mask file name missing partition number place marker (%%1)"); @@ -246,7 +246,7 @@ void makePairwiseMask(const QString &targetInput, const QString &queryInput, con const FileList targets = TemplateList::fromGallery(targetInput).files(); const FileList queries = (queryInput == ".") ? targets : TemplateList::fromGallery(queryInput).files(); const int partitions = targets.first().get("crossValidate"); - if (partitions == 0) { + if (partitions <= 0) { writeMatrix(makePairwiseMask(targets, queries), mask, targetInput, queryInput); } else { if (!mask.contains("%1")) qFatal("Mask file name missing partition number place marker (%%1)"); diff --git a/openbr/core/core.cpp b/openbr/core/core.cpp index d1ed798..bd84b93 100644 --- a/openbr/core/core.cpp +++ b/openbr/core/core.cpp @@ -69,7 +69,7 @@ struct AlgorithmCore QScopedPointer trainingWrapper(br::wrapTransform(transform.data(), "Stream(readMode=DistributeFrames)")); TemplateList data(TemplateList::fromGallery(input)); - if (Globals->crossValidate > 1) + if (abs(Globals->crossValidate) > 1) for (int i=data.size()-1; i>=0; i--) if (data[i].file.get("allPartitions",false) || data[i].file.get("duplicatePartitions",false)) data.removeAt(i); diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index fec49b8..b9f4fb4 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -434,7 +434,7 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) if (gallery.getBool("reduce")) newTemplates = newTemplates.reduced(); - if (Globals->crossValidate > 1) + if (abs(Globals->crossValidate) > 1) newTemplates = newTemplates.partition("Label"); if (!templates.isEmpty() && gallery.get("merge", false)) { diff --git a/openbr/plugins/output/eval.cpp b/openbr/plugins/output/eval.cpp index 343f7a8..b6f74d3 100644 --- a/openbr/plugins/output/eval.cpp +++ b/openbr/plugins/output/eval.cpp @@ -45,7 +45,7 @@ class evalOutput : public MatrixOutput if (data.data) { const QString csv = QString(file.name).replace(".eval", ".csv"); - if ((Globals->crossValidate == 0) || (!crossValidate)) { + if ((Globals->crossValidate <= 0) || (!crossValidate)) { Evaluate(data, targetFiles, queryFiles, csv); } else { QFutureSynchronizer futures; -- libgit2 0.21.4