Commit a2489d31e27f289ee75ffcd386fb475d4ad5eb94

Authored by Charles Otto
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 45 qDebug("Training on %s%s", qPrintable(input.flat()),
46 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 56 // set the Train bool metadata, in case a Transform's project
52 57 // needs to know if it's called during train or enroll
... ... @@ -58,7 +63,7 @@ struct AlgorithmCore
58 63  
59 64 QTime time; time.start();
60 65 qDebug("Training Enrollment");
61   - transform->train(data);
  66 + downcast->train(data);
62 67  
63 68 if (!distance.isNull()) {
64 69 qDebug("Projecting Enrollment");
... ... @@ -119,7 +124,6 @@ struct AlgorithmCore
119 124 qDebug("Enrolling %s%s", qPrintable(input.flat()),
120 125 gallery.isNull() ? "" : qPrintable(" to " + gallery.flat()));
121 126  
122   - FileList fileList;
123 127 if (gallery.name.isEmpty()) {
124 128 if (input.name.isEmpty()) return FileList();
125 129 else gallery = getMemoryGallery(input);
... ... @@ -128,7 +132,7 @@ struct AlgorithmCore
128 132 TemplateList i(TemplateList::fromGallery(input));
129 133  
130 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 136 // Make a stream with a placeholder first transform, and our progress counter/gallery output.
133 137 QScopedPointer<Transform> enrollJob(Transform::make(shellDescription, NULL));
134 138  
... ...