Commit 369c4ed1566d9d0e227dbd813449401da1611fdd

Authored by Charles Otto
1 parent 977afff2

Explicitly replace AlgorithmCore::compare with the new version of compare

Showing 1 changed file with 1 additions and 75 deletions
openbr/core/core.cpp
... ... @@ -351,79 +351,6 @@ struct AlgorithmCore
351 351 qPrintable(queryGallery.flat()),
352 352 output.isNull() ? "" : qPrintable(" to " + output.flat()));
353 353  
354   - if (output.exists() && output.get<bool>("cache", false)) return;
355   - if (queryGallery == ".") queryGallery = targetGallery;
356   -
357   - QScopedPointer<Gallery> t, q;
358   - FileList targetFiles, queryFiles;
359   - retrieveOrEnroll(targetGallery, t, targetFiles);
360   - retrieveOrEnroll(queryGallery, q, queryFiles);
361   -
362   - QList<int> partitionSizes;
363   - QList<File> outputFiles;
364   - if (output.contains("split")) {
365   - if (!output.fileName().contains("%1")) qFatal("Output file name missing split number place marker (%%1)");
366   - partitionSizes = output.getList<int>("split");
367   - for (int i=0; i<partitionSizes.size(); i++) {
368   - File splitOutputFile = output.name.arg(i);
369   - outputFiles.append(splitOutputFile);
370   - }
371   - }
372   - else outputFiles.append(output);
373   -
374   - QList<Output*> outputs;
375   - foreach (const File &outputFile, outputFiles) outputs.append(Output::make(outputFile, targetFiles, queryFiles));
376   -
377   - if (distance.isNull()) qFatal("Null distance.");
378   - Globals->currentStep = 0;
379   - Globals->totalSteps = double(targetFiles.size()) * double(queryFiles.size());
380   - Globals->startTime.start();
381   -
382   - int queryBlock = -1;
383   - bool queryDone = false;
384   - while (!queryDone) {
385   - queryBlock++;
386   - TemplateList queries = q->readBlock(&queryDone);
387   -
388   - QList<TemplateList> queryPartitions;
389   - if (!partitionSizes.empty()) queryPartitions = queries.partition(partitionSizes);
390   - else queryPartitions.append(queries);
391   -
392   - for (int i=0; i<queryPartitions.size(); i++) {
393   - int targetBlock = -1;
394   - bool targetDone = false;
395   - while (!targetDone) {
396   - targetBlock++;
397   -
398   - TemplateList targets = t->readBlock(&targetDone);
399   -
400   - QList<TemplateList> targetPartitions;
401   - if (!partitionSizes.empty()) targetPartitions = targets.partition(partitionSizes);
402   - else targetPartitions.append(targets);
403   -
404   - outputs[i]->setBlock(queryBlock, targetBlock);
405   -
406   - distance->compare(targetPartitions[i], queryPartitions[i], outputs[i]);
407   -
408   - Globals->currentStep += double(targets.size()) * double(queries.size());
409   - Globals->printStatus();
410   - }
411   - }
412   - }
413   -
414   - qDeleteAll(outputs);
415   -
416   - const float speed = 1000 * Globals->totalSteps / Globals->startTime.elapsed() / std::max(1, abs(Globals->parallelism));
417   - if (!Globals->quiet && (Globals->totalSteps > 1)) fprintf(stderr, "\rSPEED=%.1e \n", speed);
418   - Globals->totalSteps = 0;
419   - }
420   -
421   - void altCompare(File targetGallery, File queryGallery, File output)
422   - {
423   - qDebug("Comparing %s and %s%s", qPrintable(targetGallery.flat()),
424   - qPrintable(queryGallery.flat()),
425   - output.isNull() ? "" : qPrintable(" to " + output.flat()));
426   -
427 354 bool multiProcess = Globals->file.getBool("multiProcess", false);
428 355  
429 356 if (output.exists() && output.get<bool>("cache", false)) return;
... ... @@ -680,8 +607,7 @@ void br::Enroll(TemplateList &amp;tl)
680 607  
681 608 void br::Compare(const File &targetGallery, const File &queryGallery, const File &output)
682 609 {
683   - //AlgorithmManager::getAlgorithm(output.get<QString>("algorithm"))->compare(targetGallery, queryGallery, output);
684   - AlgorithmManager::getAlgorithm(output.get<QString>("algorithm"))->altCompare(targetGallery, queryGallery, output);
  610 + AlgorithmManager::getAlgorithm(output.get<QString>("algorithm"))->compare(targetGallery, queryGallery, output);
685 611 }
686 612  
687 613 void br::CompareTemplateLists(const TemplateList &target, const TemplateList &query, Output *output)
... ...