Commit cb24123a0c45062bcfbe43ea079a0891e9fcc368

Authored by Scott Klum
1 parent 6df13fa0

Handling negatives otherwhere

openbr/core/bee.cpp
... ... @@ -230,7 +230,7 @@ void makeMask(const QString &targetInput, const QString &queryInput, const QStri
230 230 const FileList targets = TemplateList::fromGallery(targetInput).files();
231 231 const FileList queries = (queryInput == ".") ? targets : TemplateList::fromGallery(queryInput).files();
232 232 const int partitions = targets.first().get<int>("crossValidate");
233   - if (partitions == 0) {
  233 + if (partitions <= 0) {
234 234 writeMatrix(makeMask(targets, queries), mask, targetInput, queryInput);
235 235 } else {
236 236 if (!mask.contains("%1")) qFatal("Mask file name missing partition number place marker (%%1)");
... ... @@ -246,7 +246,7 @@ void makePairwiseMask(const QString &amp;targetInput, const QString &amp;queryInput, con
246 246 const FileList targets = TemplateList::fromGallery(targetInput).files();
247 247 const FileList queries = (queryInput == ".") ? targets : TemplateList::fromGallery(queryInput).files();
248 248 const int partitions = targets.first().get<int>("crossValidate");
249   - if (partitions == 0) {
  249 + if (partitions <= 0) {
250 250 writeMatrix(makePairwiseMask(targets, queries), mask, targetInput, queryInput);
251 251 } else {
252 252 if (!mask.contains("%1")) qFatal("Mask file name missing partition number place marker (%%1)");
... ...
openbr/core/core.cpp
... ... @@ -69,7 +69,7 @@ struct AlgorithmCore
69 69 QScopedPointer<Transform> trainingWrapper(br::wrapTransform(transform.data(), "Stream(readMode=DistributeFrames)"));
70 70 TemplateList data(TemplateList::fromGallery(input));
71 71  
72   - if (Globals->crossValidate > 1)
  72 + if (abs(Globals->crossValidate) > 1)
73 73 for (int i=data.size()-1; i>=0; i--)
74 74 if (data[i].file.get<bool>("allPartitions",false) || data[i].file.get<bool>("duplicatePartitions",false))
75 75 data.removeAt(i);
... ...
openbr/openbr_plugin.cpp
... ... @@ -434,7 +434,7 @@ TemplateList TemplateList::fromGallery(const br::File &amp;gallery)
434 434 if (gallery.getBool("reduce"))
435 435 newTemplates = newTemplates.reduced();
436 436  
437   - if (Globals->crossValidate > 1)
  437 + if (abs(Globals->crossValidate) > 1)
438 438 newTemplates = newTemplates.partition("Label");
439 439  
440 440 if (!templates.isEmpty() && gallery.get<bool>("merge", false)) {
... ...
openbr/plugins/output/eval.cpp
... ... @@ -45,7 +45,7 @@ class evalOutput : public MatrixOutput
45 45  
46 46 if (data.data) {
47 47 const QString csv = QString(file.name).replace(".eval", ".csv");
48   - if ((Globals->crossValidate == 0) || (!crossValidate)) {
  48 + if ((Globals->crossValidate <= 0) || (!crossValidate)) {
49 49 Evaluate(data, targetFiles, queryFiles, csv);
50 50 } else {
51 51 QFutureSynchronizer<float> futures;
... ...