Commit a2489d31e27f289ee75ffcd386fb475d4ad5eb94
1 parent
a29de4c1
Remove some debug output, add a stream to AlgorithmCore::train
Since we no longer add distribute in AlgorithmCore::init, instead adding a task specific stream in AlgorithmCore::enroll, we also add a stream to the algorithm in train, so that the training data will be projected in parallel by PipeTransform::train.
Showing
1 changed file
with
8 additions
and
4 deletions
openbr/core/core.cpp
| @@ -45,8 +45,13 @@ struct AlgorithmCore | @@ -45,8 +45,13 @@ struct AlgorithmCore | ||
| 45 | qDebug("Training on %s%s", qPrintable(input.flat()), | 45 | qDebug("Training on %s%s", qPrintable(input.flat()), |
| 46 | model.isEmpty() ? "" : qPrintable(" to " + model)); | 46 | model.isEmpty() ? "" : qPrintable(" to " + model)); |
| 47 | 47 | ||
| 48 | - TemplateList data(TemplateList::fromGallery(input)); | 48 | + QScopedPointer<Transform> trainingWrapper(Transform::make("DirectStream([Identity])", NULL)); |
| 49 | + CompositeTransform * downcast = dynamic_cast<CompositeTransform *>(trainingWrapper.data()); | ||
| 50 | + if (downcast == NULL) | ||
| 51 | + qFatal("downcast failed?"); | ||
| 52 | + downcast->transforms[0] = this->transform.data(); | ||
| 49 | 53 | ||
| 54 | + TemplateList data(TemplateList::fromGallery(input)); | ||
| 50 | 55 | ||
| 51 | // set the Train bool metadata, in case a Transform's project | 56 | // set the Train bool metadata, in case a Transform's project |
| 52 | // needs to know if it's called during train or enroll | 57 | // needs to know if it's called during train or enroll |
| @@ -58,7 +63,7 @@ struct AlgorithmCore | @@ -58,7 +63,7 @@ struct AlgorithmCore | ||
| 58 | 63 | ||
| 59 | QTime time; time.start(); | 64 | QTime time; time.start(); |
| 60 | qDebug("Training Enrollment"); | 65 | qDebug("Training Enrollment"); |
| 61 | - transform->train(data); | 66 | + downcast->train(data); |
| 62 | 67 | ||
| 63 | if (!distance.isNull()) { | 68 | if (!distance.isNull()) { |
| 64 | qDebug("Projecting Enrollment"); | 69 | qDebug("Projecting Enrollment"); |
| @@ -119,7 +124,6 @@ struct AlgorithmCore | @@ -119,7 +124,6 @@ struct AlgorithmCore | ||
| 119 | qDebug("Enrolling %s%s", qPrintable(input.flat()), | 124 | qDebug("Enrolling %s%s", qPrintable(input.flat()), |
| 120 | gallery.isNull() ? "" : qPrintable(" to " + gallery.flat())); | 125 | gallery.isNull() ? "" : qPrintable(" to " + gallery.flat())); |
| 121 | 126 | ||
| 122 | - FileList fileList; | ||
| 123 | if (gallery.name.isEmpty()) { | 127 | if (gallery.name.isEmpty()) { |
| 124 | if (input.name.isEmpty()) return FileList(); | 128 | if (input.name.isEmpty()) return FileList(); |
| 125 | else gallery = getMemoryGallery(input); | 129 | else gallery = getMemoryGallery(input); |
| @@ -128,7 +132,7 @@ struct AlgorithmCore | @@ -128,7 +132,7 @@ struct AlgorithmCore | ||
| 128 | TemplateList i(TemplateList::fromGallery(input)); | 132 | TemplateList i(TemplateList::fromGallery(input)); |
| 129 | 133 | ||
| 130 | QString shellDescription = "DirectStream([Identity,ProgressCounter("+QString::number(i.length())+")+GalleryOutput("+gallery.flat()+")+Discard],readMode=DistributeFrames)"; | 134 | QString shellDescription = "DirectStream([Identity,ProgressCounter("+QString::number(i.length())+")+GalleryOutput("+gallery.flat()+")+Discard],readMode=DistributeFrames)"; |
| 131 | - qDebug("built shell string %s", qPrintable(shellDescription)); | 135 | + |
| 132 | // Make a stream with a placeholder first transform, and our progress counter/gallery output. | 136 | // Make a stream with a placeholder first transform, and our progress counter/gallery output. |
| 133 | QScopedPointer<Transform> enrollJob(Transform::make(shellDescription, NULL)); | 137 | QScopedPointer<Transform> enrollJob(Transform::make(shellDescription, NULL)); |
| 134 | 138 |