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