From 5f87009828bf064f7b9091d6617d66dfe88b4c4b Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Thu, 1 Aug 2013 19:38:45 -0400 Subject: [PATCH] Consider timeVarying status of child transforms in pipe project --- openbr/plugins/meta.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/openbr/plugins/meta.cpp b/openbr/plugins/meta.cpp index b5e14cb..c8df4c5 100644 --- a/openbr/plugins/meta.cpp +++ b/openbr/plugins/meta.cpp @@ -104,6 +104,25 @@ class PipeTransform : public CompositeTransform fprintf(stderr, " training..."); transforms[i]->train(copy); } + // if the transform is time varying, we batch project it. + if (transforms[i]->timeVarying()) { + fprintf(stderr, "\n%s projecting...", qPrintable(transforms[i]->objectName())); + transforms[i]->projectUpdate(copy, copy); + + // advance i since we already projected for this stage. + i++; + + // set up the single item lists since they are inconsistent again. + singleItemLists.clear(); + for (int j=0; j < copy.size(); j++) + { + TemplateList temp; + temp.append(copy[j]); + singleItemLists.append(temp); + } + // the next stage might be trainable, so continue to evaluate it. + continue; + } // We project through any subsequent untrainable transforms at once // as a memory optimization in case any of these intermediate @@ -112,7 +131,8 @@ class PipeTransform : public CompositeTransform // by that transform at once if we can avoid it. int nextTrainableTransform = i+1; while ((nextTrainableTransform < transforms.size()) && - !transforms[nextTrainableTransform]->trainable) + !transforms[nextTrainableTransform]->trainable && + !transforms[nextTrainableTransform]->timeVarying()) nextTrainableTransform++; fprintf(stderr, " projecting..."); -- libgit2 0.21.4