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