Commit 20e3c75f45958ad76baef7d277c0996c3bab61d1
1 parent
092cef71
refactored training feedback
Showing
2 changed files
with
4 additions
and
34 deletions
app/br/br.cpp
| ... | ... | @@ -231,14 +231,12 @@ int main(int argc, char *argv[]) |
| 231 | 231 | br_initialize(argc, argv); |
| 232 | 232 | |
| 233 | 233 | // Do argument execution in another thread so this main thread can run an event loop. |
| 234 | - // When adding fakeMain to the global thread pool we give it low priority | |
| 234 | + // When adding fakeMain to the global thread pool we give it a higher (slower) priority | |
| 235 | 235 | // so that it is preempted when parallel work is available, |
| 236 | 236 | // otherwise we would only achieve (n-1)/n CPU utilization. |
| 237 | 237 | FakeMain *fakeMain = new FakeMain(argc, argv); |
| 238 | - QThreadPool::globalInstance()->start(fakeMain, -1); | |
| 238 | + QThreadPool::globalInstance()->start(fakeMain, 1); | |
| 239 | 239 | QCoreApplication::exec(); |
| 240 | 240 | |
| 241 | 241 | br_finalize(); |
| 242 | 242 | } |
| 243 | - | |
| 244 | -#include "br.moc" | ... | ... |
sdk/plugins/meta.cpp
| ... | ... | @@ -61,31 +61,6 @@ static void _train(Transform *transform, const TemplateList *data) |
| 61 | 61 | transform->train(*data); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -// For handling progress feedback | |
| 65 | -static int depth = 0; | |
| 66 | - | |
| 67 | -static void acquireStep() | |
| 68 | -{ | |
| 69 | - if (depth == 0) { | |
| 70 | - Globals->currentStep = 0; | |
| 71 | - Globals->totalSteps = 1; | |
| 72 | - } | |
| 73 | - depth++; | |
| 74 | -} | |
| 75 | - | |
| 76 | -static void releaseStep() | |
| 77 | -{ | |
| 78 | - depth--; | |
| 79 | - Globals->currentStep = floor(Globals->currentStep * pow(10.0, double(depth))) / pow(10.0, double(depth)); | |
| 80 | - if (depth == 0) | |
| 81 | - Globals->totalSteps = 0; | |
| 82 | -} | |
| 83 | - | |
| 84 | -static void incrementStep() | |
| 85 | -{ | |
| 86 | - Globals->currentStep += 1.0 / pow(10.0, double(depth)); | |
| 87 | -} | |
| 88 | - | |
| 89 | 64 | /*! |
| 90 | 65 | * \ingroup Transforms |
| 91 | 66 | * \brief Transforms in series. |
| ... | ... | @@ -102,16 +77,13 @@ class PipeTransform : public CompositeTransform |
| 102 | 77 | |
| 103 | 78 | void train(const TemplateList &data) |
| 104 | 79 | { |
| 105 | - acquireStep(); | |
| 106 | - | |
| 107 | 80 | TemplateList copy(data); |
| 108 | 81 | for (int i=0; i<transforms.size(); i++) { |
| 82 | + fprintf(stderr, "%s training... ", qPrintable(transforms[i]->objectName())); | |
| 109 | 83 | transforms[i]->train(copy); |
| 84 | + fprintf(stderr, "projecting...\n"); | |
| 110 | 85 | copy >> *transforms[i]; |
| 111 | - incrementStep(); | |
| 112 | 86 | } |
| 113 | - | |
| 114 | - releaseStep(); | |
| 115 | 87 | } |
| 116 | 88 | |
| 117 | 89 | void backProject(const Template &dst, Template &src) const | ... | ... |