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