Commit 3b2f1a6404b011114e44aa61bde00785c5a997c2

Authored by Josh Klontz
1 parent 56148599

TemplateList::fromInput() updated to TemplateList::fromGallery() to reflect the …

…fact that the Input class was generalized into the Gallery class a while ago.
sdk/core/bee.cpp
... ... @@ -227,8 +227,8 @@ void BEE::makeMask(const QString &targetInput, const QString &queryInput, const
227 227 {
228 228 qDebug("Making mask from %s and %s to %s", qPrintable(targetInput), qPrintable(queryInput), qPrintable(mask));
229 229  
230   - FileList targetFiles = TemplateList::fromInput(targetInput).files();
231   - FileList queryFiles = TemplateList::fromInput(queryInput).files();
  230 + FileList targetFiles = TemplateList::fromGallery(targetInput).files();
  231 + FileList queryFiles = TemplateList::fromGallery(queryInput).files();
232 232 QList<float> targetLabels = targetFiles.labels();
233 233 QList<float> queryLabels = queryFiles.labels();
234 234 QList<int> targetPartitions = targetFiles.crossValidationPartitions();
... ...
sdk/core/classify.cpp
... ... @@ -37,8 +37,8 @@ void br::EvalClassification(const QString &amp;predictedInput, const QString &amp;truthI
37 37 {
38 38 qDebug("Evaluating classification of %s against %s", qPrintable(predictedInput), qPrintable(truthInput));
39 39  
40   - TemplateList predicted(TemplateList::fromInput(predictedInput));
41   - TemplateList truth(TemplateList::fromInput(truthInput));
  40 + TemplateList predicted(TemplateList::fromGallery(predictedInput));
  41 + TemplateList truth(TemplateList::fromGallery(truthInput));
42 42 if (predicted.size() != truth.size()) qFatal("Input size mismatch.");
43 43  
44 44 QHash<int, Counter> counters;
... ... @@ -83,8 +83,8 @@ void br::EvalRegression(const QString &amp;predictedInput, const QString &amp;truthInput
83 83 {
84 84 qDebug("Evaluating regression of %s against %s", qPrintable(predictedInput), qPrintable(truthInput));
85 85  
86   - const TemplateList predicted(TemplateList::fromInput(predictedInput));
87   - const TemplateList truth(TemplateList::fromInput(truthInput));
  86 + const TemplateList predicted(TemplateList::fromGallery(predictedInput));
  87 + const TemplateList truth(TemplateList::fromGallery(truthInput));
88 88 if (predicted.size() != truth.size()) qFatal("Input size mismatch.");
89 89  
90 90 float rmsError = 0;
... ...
sdk/core/cluster.cpp
... ... @@ -278,7 +278,7 @@ void br::EvalClustering(const QString &amp;csv, const QString &amp;input)
278 278 {
279 279 qDebug("Evaluating %s against %s", qPrintable(csv), qPrintable(input));
280 280  
281   - QList<float> labels = TemplateList::fromInput(input).files().labels();
  281 + QList<float> labels = TemplateList::fromGallery(input).files().labels();
282 282  
283 283 QHash<int, int> labelToIndex;
284 284 int nClusters = 0;
... ...
sdk/core/core.cpp
... ... @@ -40,7 +40,7 @@ struct AlgorithmCore
40 40  
41 41 void train(const File &input, const QString &model)
42 42 {
43   - TemplateList data(TemplateList::fromInput(input));
  43 + TemplateList data(TemplateList::fromGallery(input));
44 44  
45 45 if (transform.isNull()) qFatal("Null transform.");
46 46 qDebug("%d training files", data.size());
... ... @@ -118,7 +118,7 @@ struct AlgorithmCore
118 118 if (!fileList.isEmpty() && gallery.contains("cache"))
119 119 return fileList;
120 120  
121   - const TemplateList i(TemplateList::fromInput(input));
  121 + const TemplateList i(TemplateList::fromGallery(input));
122 122 if (i.isEmpty()) return fileList; // Nothing to enroll
123 123  
124 124 if (transform.isNull()) qFatal("Null transform.");
... ...
sdk/openbr.cpp
... ... @@ -204,7 +204,7 @@ void br_read_line(int *argc, const char ***argv)
204 204  
205 205 void br_reformat(const char *target_input, const char *query_input, const char *simmat, const char *output)
206 206 {
207   - Output::reformat(TemplateList::fromInput(target_input).files(), TemplateList::fromInput(query_input).files(), simmat, output);
  207 + Output::reformat(TemplateList::fromGallery(target_input).files(), TemplateList::fromGallery(query_input).files(), simmat, output);
208 208 }
209 209  
210 210 const char *br_scratch_path()
... ...
sdk/openbr_plugin.cpp
... ... @@ -445,14 +445,14 @@ QDataStream &amp;br::operator&gt;&gt;(QDataStream &amp;stream, Template &amp;t)
445 445 }
446 446  
447 447 /* TemplateList - public methods */
448   -TemplateList TemplateList::fromInput(const br::File &input)
  448 +TemplateList TemplateList::fromGallery(const br::File &gallery)
449 449 {
450 450 TemplateList templates;
451 451  
452   - foreach (const br::File &file, input.split()) {
  452 + foreach (const br::File &file, gallery.split()) {
453 453 QScopedPointer<Gallery> i(Gallery::make(file));
454 454 TemplateList newTemplates = i->read();
455   - const int crossValidate = input.getInt("crossValidate");
  455 + const int crossValidate = gallery.getInt("crossValidate");
456 456 if (crossValidate > 0) srand(0);
457 457  
458 458 // If file is a Format not a Gallery
... ... @@ -461,13 +461,13 @@ TemplateList TemplateList::fromInput(const br::File &amp;input)
461 461  
462 462 // Propogate metadata
463 463 for (int i=0; i<newTemplates.size(); i++) {
464   - newTemplates[i].file.append(input.localMetadata());
  464 + newTemplates[i].file.append(gallery.localMetadata());
465 465 newTemplates[i].file.append(file.localMetadata());
466 466 newTemplates[i].file.insert("Input_Index", i+templates.size());
467 467 if (crossValidate > 0) newTemplates[i].file.insert("Cross_Validation_Partition", rand()%crossValidate);
468 468 }
469 469  
470   - if (!templates.isEmpty() && input.getBool("merge")) {
  470 + if (!templates.isEmpty() && gallery.getBool("merge")) {
471 471 if (newTemplates.size() != templates.size())
472 472 qFatal("Inputs must be the same size in order to merge.");
473 473 for (int i=0; i<templates.size(); i++)
... ...
sdk/openbr_plugin.h
... ... @@ -332,8 +332,9 @@ struct TemplateList : public QList&lt;Template&gt;
332 332 TemplateList() : uniform(false) {}
333 333 TemplateList(const QList<Template> &templates) : uniform(false) { append(templates); } /*!< \brief Initialize the template list from another template list. */
334 334 TemplateList(const QList<File> &files) : uniform(false) { foreach (const File &file, files) append(file); } /*!< \brief Initialize the template list from a file list. */
335   - BR_EXPORT static TemplateList fromInput(const File &input); /*!< \brief Create a template list from a br::Input. */
  335 + BR_EXPORT static TemplateList fromGallery(const File &gallery); /*!< \brief Create a template list from a br::Gallery. */
336 336 BR_EXPORT static TemplateList relabel(const TemplateList &tl); /*!< \brief Ensure labels are in the range [0,numClasses-1]. */
  337 +
337 338 /*!
338 339 * \brief Returns the total number of bytes in all the templates.
339 340 */
... ...
sdk/plugins/youtube.cpp
... ... @@ -33,10 +33,10 @@ class YouTubeFacesDBTransform : public UntrainableMetaTransform
33 33 const QStringList words = src.file.name.split(", ");
34 34 dst.file.name = words[0] + "_" + words[1] + "_" + words[4] + ".mtx";
35 35  
36   - TemplateList queryTemplates = TemplateList::fromInput(File(words[2]).resolved());
  36 + TemplateList queryTemplates = TemplateList::fromGallery(File(words[2]).resolved());
37 37 queryTemplates >> *transform;
38 38  
39   - TemplateList targetTemplates = TemplateList::fromInput(File(words[3]).resolved());
  39 + TemplateList targetTemplates = TemplateList::fromGallery(File(words[3]).resolved());
40 40 targetTemplates >> *transform;
41 41  
42 42 QScopedPointer<MatrixOutput> memoryOutput(MatrixOutput::make(targetTemplates.files(), queryTemplates.files()));
... ...