Commit 50f1dd39ec2332bdf6fc8d2730977737ad057d59
1 parent
9633db66
Only train if transform is trainable
Showing
1 changed file
with
7 additions
and
5 deletions
openbr/plugins/imgproc/if.cpp
| @@ -48,11 +48,13 @@ class IfTransform : public Transform | @@ -48,11 +48,13 @@ class IfTransform : public Transform | ||
| 48 | public: | 48 | public: |
| 49 | void train(const TemplateList &data) | 49 | void train(const TemplateList &data) |
| 50 | { | 50 | { |
| 51 | - TemplateList passed; | ||
| 52 | - for (int i=0; i<data.size(); i++) | ||
| 53 | - if (compare(data[i].file.get<QString>(key))) | ||
| 54 | - passed.append(data[i]); | ||
| 55 | - transform->train(passed); | 51 | + if (transform->trainable) { |
| 52 | + TemplateList passed; | ||
| 53 | + for (int i=0; i<data.size(); i++) | ||
| 54 | + if (compare(data[i].file.get<QString>(key))) | ||
| 55 | + passed.append(data[i]); | ||
| 56 | + transform->train(passed); | ||
| 57 | + } | ||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | void project(const Template &src, Template &dst) const { | 60 | void project(const Template &src, Template &dst) const { |