diff --git a/openbr/core/core.cpp b/openbr/core/core.cpp index acde657..9f81649 100644 --- a/openbr/core/core.cpp +++ b/openbr/core/core.cpp @@ -47,12 +47,12 @@ struct AlgorithmCore qDebug("Training on %s%s", qPrintable(input.flat()), model.isEmpty() ? "" : qPrintable(" to " + model)); - QScopedPointer trainingWrapper(Transform::make("DirectStream([Identity], readMode=DistributeFrames)", NULL)); + QScopedPointer trainingWrapper(Transform::make("DirectStream(readMode=DistributeFrames)", NULL)); CompositeTransform * downcast = dynamic_cast(trainingWrapper.data()); if (downcast == NULL) qFatal("downcast failed?"); - downcast->transforms[0] = this->transform.data(); + downcast->transforms.append(this->transform.data()); downcast->init(); @@ -163,14 +163,14 @@ struct AlgorithmCore if (!multiProcess) { - QString pipeDesc = "Identity+GalleryOutput("+gallery.flat()+")+ProgressCounter("+QString::number(data.length())+")+Discard"; + QString pipeDesc = "GalleryOutput("+gallery.flat()+")+ProgressCounter("+QString::number(data.length())+")+Discard"; basePipe.reset(Transform::make(pipeDesc,NULL)); CompositeTransform * downcast = dynamic_cast(basePipe.data()); if (downcast == NULL) qFatal("downcast failed?"); // replace that placeholder with the current algorithm - downcast->transforms[0] = this->transform.data(); + downcast->transforms.prepend(this->transform.data()); // call init on the pipe to collapse the algorithm (if its top level is a pipe) downcast->init(); @@ -182,7 +182,7 @@ struct AlgorithmCore } // Next, we make a Stream (with placeholder transform) - QString streamDesc = "Stream(Identity, readMode=DistributeFrames)"; + QString streamDesc = "Stream(readMode=DistributeFrames)"; QScopedPointer baseStream(Transform::make(streamDesc, NULL)); WrapperTransform * wrapper = dynamic_cast (baseStream.data()); @@ -428,7 +428,7 @@ struct AlgorithmCore // The actual comparison step is done by a GalleryCompare transform, which has a Distance, and a gallery as data. // Incoming templates are compared against the templates in the gallery, and the output is the resulting score // vector. - QString compareRegionDesc = "GalleryCompare("+Globals->algorithm + "," + colEnrolledGallery.flat() + ")"; + QString compareRegionDesc = "Pipe([GalleryCompare("+Globals->algorithm + "," + colEnrolledGallery.flat() + ")])"; QScopedPointer compareRegion; @@ -438,13 +438,13 @@ struct AlgorithmCore { if (!multiProcess) { - compareRegionDesc = "Identity+" + compareRegionDesc; + compareRegionDesc = compareRegionDesc; compareRegion.reset(Transform::make(compareRegionDesc,NULL)); CompositeTransform * downcast = dynamic_cast (compareRegion.data()); if (downcast == NULL) qFatal("Pipe downcast failed in compare"); - downcast->transforms[0] = this->transform.data(); + downcast->transforms.prepend(this->transform.data()); downcast->init(); } else @@ -467,7 +467,7 @@ struct AlgorithmCore // We also need to add Output and progress counting to the algorithm we are building, so we will assign them to // two stages of a pipe. - QString joinDesc = "Identity+Identity"; + QString joinDesc = "Pipe()"; QScopedPointer join(Transform::make(joinDesc, NULL)); // The output transform takes the metadata memGalleries we set up previously as input, along with the @@ -481,8 +481,8 @@ struct AlgorithmCore // Assign the comparison transform we previously built, and the output transform we just built to // two stages of a pipe. CompositeTransform * downcast = dynamic_cast (join.data()); - downcast->transforms[0] = compareRegion.data(); - downcast->transforms[1] = outputTform.data(); + downcast->transforms.append(compareRegion.data()); + downcast->transforms.append(outputTform.data()); // With this, we have set up a transform which (optionally) enrolls templates, compares them // against a gallery, and outputs them. @@ -490,7 +490,7 @@ struct AlgorithmCore // Now, we will give that base transform to a stream, which will incrementally read the row gallery // and pass the transforms it reads through the base algorithm. - QString streamDesc = "Stream(Identity, readMode=StreamGallery)"; + QString streamDesc = "Stream(readMode=StreamGallery)"; QScopedPointer streamBase(Transform::make(streamDesc, NULL)); WrapperTransform * streamWrapper = dynamic_cast (streamBase.data()); streamWrapper->transform = join.data(); @@ -706,7 +706,7 @@ QSharedPointer br::Transform::fromAlgorithm(const QString &algori return AlgorithmManager::getAlgorithm(algorithm)->transform; else { QSharedPointer orig_tform = AlgorithmManager::getAlgorithm(algorithm)->transform; - QSharedPointer newRoot = QSharedPointer(Transform::make("Stream(Identity, readMode=DistributeFrames)", NULL)); + QSharedPointer newRoot = QSharedPointer(Transform::make("Stream(readMode=DistributeFrames)", NULL)); WrapperTransform * downcast = dynamic_cast (newRoot.data()); downcast->transform = orig_tform.data(); downcast->init();