Commit 2f14b079ea5c7e645d870ca385436b4c176ad9c1
1 parent
c7d69e72
Allows project to occur when training other transforms
Showing
1 changed file
with
6 additions
and
2 deletions
openbr/plugins/slidingwindow.cpp
| @@ -56,9 +56,11 @@ class SlidingWindowTransform : public MetaTransform | @@ -56,9 +56,11 @@ class SlidingWindowTransform : public MetaTransform | ||
| 56 | 56 | ||
| 57 | private: | 57 | private: |
| 58 | int windowHeight; | 58 | int windowHeight; |
| 59 | + bool skipProject; | ||
| 59 | 60 | ||
| 60 | void train(const TemplateList &data) | 61 | void train(const TemplateList &data) |
| 61 | { | 62 | { |
| 63 | + skipProject = true; | ||
| 62 | float aspectRatio = data.first().file.get<float>("aspectRatio", -1); | 64 | float aspectRatio = data.first().file.get<float>("aspectRatio", -1); |
| 63 | if (aspectRatio == -1) | 65 | if (aspectRatio == -1) |
| 64 | aspectRatio = getAspectRatio(data); | 66 | aspectRatio = getAspectRatio(data); |
| @@ -104,7 +106,7 @@ protected: | @@ -104,7 +106,7 @@ protected: | ||
| 104 | void projectHelp(const TemplateList &src, TemplateList &dst, int windowWidth, int windowHeight, float scale = 1) const | 106 | void projectHelp(const TemplateList &src, TemplateList &dst, int windowWidth, int windowHeight, float scale = 1) const |
| 105 | { | 107 | { |
| 106 | // no need to slide a window over ground truth data | 108 | // no need to slide a window over ground truth data |
| 107 | - if (src.first().file.getBool("Train", false)) { | 109 | + if (skipProject) { |
| 108 | dst = src; | 110 | dst = src; |
| 109 | return; | 111 | return; |
| 110 | } | 112 | } |
| @@ -243,9 +245,11 @@ class BuildScalesTransform : public MetaTransform | @@ -243,9 +245,11 @@ class BuildScalesTransform : public MetaTransform | ||
| 243 | private: | 245 | private: |
| 244 | float aspectRatio; | 246 | float aspectRatio; |
| 245 | int windowHeight; | 247 | int windowHeight; |
| 248 | + bool skipProject; | ||
| 246 | 249 | ||
| 247 | void train(const TemplateList &data) | 250 | void train(const TemplateList &data) |
| 248 | { | 251 | { |
| 252 | + skipProject = true; | ||
| 249 | aspectRatio = getAspectRatio(data); | 253 | aspectRatio = getAspectRatio(data); |
| 250 | windowHeight = qRound(windowWidth / aspectRatio); | 254 | windowHeight = qRound(windowWidth / aspectRatio); |
| 251 | if (transform->trainable) { | 255 | if (transform->trainable) { |
| @@ -268,7 +272,7 @@ private: | @@ -268,7 +272,7 @@ private: | ||
| 268 | void project(const TemplateList &src, TemplateList &dst) const | 272 | void project(const TemplateList &src, TemplateList &dst) const |
| 269 | { | 273 | { |
| 270 | // do not scale images during training | 274 | // do not scale images during training |
| 271 | - if (src.first().file.getBool("Train", false)) { | 275 | + if (skipProject) { |
| 272 | dst = src; | 276 | dst = src; |
| 273 | return; | 277 | return; |
| 274 | } | 278 | } |