Commit 04ecd5756fc02ba9754a029e8b186e2bca574e23

Authored by Charles Otto
1 parent 7e8092da

In pipe::Train, make timeVarying transforms project singleItemLists

Showing 1 changed file with 9 additions and 10 deletions
openbr/plugins/meta.cpp
@@ -104,22 +104,21 @@ class PipeTransform : public CompositeTransform @@ -104,22 +104,21 @@ class PipeTransform : public CompositeTransform
104 fprintf(stderr, " training..."); 104 fprintf(stderr, " training...");
105 transforms[i]->train(copy); 105 transforms[i]->train(copy);
106 } 106 }
107 - // if the transform is time varying, we batch project it. 107 +
  108 + // if the transform is time varying, we can't project it in parallel
108 if (transforms[i]->timeVarying()) { 109 if (transforms[i]->timeVarying()) {
109 fprintf(stderr, "\n%s projecting...", qPrintable(transforms[i]->objectName())); 110 fprintf(stderr, "\n%s projecting...", qPrintable(transforms[i]->objectName()));
110 - transforms[i]->projectUpdate(copy, copy); 111 + for (int j=0; j < singleItemLists.size();j++)
  112 + transforms[i]->projectUpdate(singleItemLists[j], singleItemLists[j]);
111 113
112 // advance i since we already projected for this stage. 114 // advance i since we already projected for this stage.
113 i++; 115 i++;
114 116
115 - // set up the single item lists since they are inconsistent again.  
116 - singleItemLists.clear();  
117 - for (int j=0; j < copy.size(); j++)  
118 - {  
119 - TemplateList temp;  
120 - temp.append(copy[j]);  
121 - singleItemLists.append(temp);  
122 - } 117 + // set up copy again
  118 + copy.clear();
  119 + for (int j=0; j < singleItemLists.size(); j++)
  120 + copy.append(singleItemLists[j]);
  121 +
123 // the next stage might be trainable, so continue to evaluate it. 122 // the next stage might be trainable, so continue to evaluate it.
124 continue; 123 continue;
125 } 124 }