Commit 5cd55024289b93aa6ab491f3e14c344691790016
1 parent
32bfcd72
Removed Train flag logic from crossValidate to facilitate training distances properly
Showing
3 changed files
with
10 additions
and
12 deletions
openbr/plugins/independent.cpp
| ... | ... | @@ -156,8 +156,8 @@ class IndependentTransform : public MetaTransform |
| 156 | 156 | |
| 157 | 157 | QFutureSynchronizer<void> futures; |
| 158 | 158 | for (int i=0; i<templatesList.size(); i++) |
| 159 | - futures.addFuture(QtConcurrent::run(_train, transforms[i], &templatesList[i])); | |
| 160 | - futures.waitForFinished(); | |
| 159 | + futures.addFuture(QtConcurrent::run(_train, transforms[i], &templatesList[i])); | |
| 160 | + futures.waitForFinished(); | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | void project(const Template &src, Template &dst) const | ... | ... |
openbr/plugins/quality.cpp
| ... | ... | @@ -173,7 +173,7 @@ class MatchProbabilityDistance : public Distance |
| 173 | 173 | for (int j=0; j<i; j++) { |
| 174 | 174 | const float score = matrixOutput.data()->data.at<float>(i, j); |
| 175 | 175 | if (score == -std::numeric_limits<float>::max()) continue; |
| 176 | - if (crossModality) if(src[i].file.get<QString>("MODALITY") == src[j].file.get<QString>("MODALITY")) continue; | |
| 176 | + if (crossModality && src[i].file.get<QString>("MODALITY") == src[j].file.get<QString>("MODALITY")) continue; | |
| 177 | 177 | if (labels[i] == labels[j]) genuineScores.append(score); |
| 178 | 178 | else impostorScores.append(score); |
| 179 | 179 | } | ... | ... |
openbr/plugins/validate.cpp
| ... | ... | @@ -104,15 +104,13 @@ class CrossValidateTransform : public MetaTransform |
| 104 | 104 | // since it is assumed that the allPartitions |
| 105 | 105 | // flag is only used during comparison |
| 106 | 106 | // (i.e. only used when making a mask) |
| 107 | - if (src.file.getBool("Train", false)) dst = src; | |
| 108 | - else { | |
| 109 | - // If we want to duplicate templates but use the same training data | |
| 110 | - // for all partitions (i.e. transforms.size() == 1), we need to | |
| 111 | - // restrict the partition | |
| 112 | - int partition = src.file.get<int>("Partition", 0); | |
| 113 | - partition = (partition >= transforms.size()) ? 0 : partition; | |
| 114 | - transforms[partition]->project(src, dst); | |
| 115 | - } | |
| 107 | + | |
| 108 | + // If we want to duplicate templates but use the same training data | |
| 109 | + // for all partitions (i.e. transforms.size() == 1), we need to | |
| 110 | + // restrict the partition | |
| 111 | + int partition = src.file.get<int>("Partition", 0); | |
| 112 | + partition = (partition >= transforms.size()) ? 0 : partition; | |
| 113 | + transforms[partition]->project(src, dst); | |
| 116 | 114 | } |
| 117 | 115 | |
| 118 | 116 | void store(QDataStream &stream) const | ... | ... |