Commit 73a3464f53809c8e2bbb934e0d9ffac91dd1554c

Authored by Josh Klontz
2 parents cdd156b0 e9f1e88d

Merge branch 'master' of https://github.com/biometrics/openbr

openbr/core/classify.cpp
... ... @@ -45,8 +45,12 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI
45 45 qFatal("Input order mismatch.");
46 46  
47 47 // Typically these lists will be of length one, but this generalization allows measuring multi-class labeling accuracy.
48   - QStringList predictedSubjects = predicted[i].file.get<QStringList>("Subject");
49   - QStringList trueSubjects = truth[i].file.get<QStringList>("Subject");
  48 + QString predictedSubject = predicted[i].file.subject();
  49 + QString trueSubject = truth[i].file.subject();
  50 +
  51 + QStringList predictedSubjects(predictedSubject);
  52 + QStringList trueSubjects(trueSubject);
  53 +
50 54 foreach (const QString &subject, trueSubjects.toVector() /* Hack to copy the list. */) {
51 55 if (predictedSubjects.contains(subject)) {
52 56 counters[subject].truePositive++;
... ...
openbr/openbr_plugin.cpp
... ... @@ -183,6 +183,11 @@ float File::label() const
183 183 if (s.isNull()) return -1;
184 184  
185 185 const QString subject = s.toString();
  186 +
  187 + bool is_num = false;
  188 + float num = subject.toFloat(&is_num);
  189 + if (is_num) return num;
  190 +
186 191 static QMutex mutex;
187 192 QMutexLocker mutexLocker(&mutex);
188 193 if (!Globals->subjects.contains(subject))
... ...
openbr/plugins/meta.cpp
... ... @@ -76,7 +76,7 @@ class PipeTransform : public CompositeTransform
76 76 {
77 77 Q_OBJECT
78 78  
79   - void _projectPartial(Template *srcdst, int startIndex, int stopIndex)
  79 + void _projectPartial(TemplateList *srcdst, int startIndex, int stopIndex)
80 80 {
81 81 for (int i=startIndex; i<stopIndex; i++)
82 82 *srcdst >> *transforms[i];
... ... @@ -87,6 +87,14 @@ class PipeTransform : public CompositeTransform
87 87 if (!trainable) return;
88 88  
89 89 TemplateList copy(data);
  90 + QList<TemplateList> singleItemLists;
  91 + for (int i=0; i < copy.size(); i++)
  92 + {
  93 + TemplateList temp;
  94 + temp.append(copy[i]);
  95 + singleItemLists.append(temp);
  96 + }
  97 +
90 98 int i = 0;
91 99 while (i < transforms.size()) {
92 100 fprintf(stderr, "\n%s", qPrintable(transforms[i]->objectName()));
... ... @@ -109,9 +117,14 @@ class PipeTransform : public CompositeTransform
109 117  
110 118 fprintf(stderr, " projecting...");
111 119 QFutureSynchronizer<void> futures;
112   - for (int j=0; j<copy.size(); j++)
113   - futures.addFuture(QtConcurrent::run(this, &PipeTransform::_projectPartial, &copy[j], i, nextTrainableTransform));
  120 + for (int j=0; j < singleItemLists.size(); j++)
  121 + futures.addFuture(QtConcurrent::run(this, &PipeTransform::_projectPartial, &singleItemLists[j], i, nextTrainableTransform));
114 122 futures.waitForFinished();
  123 +
  124 + copy.clear();
  125 + for (int j=0; j < singleItemLists.size(); j++)
  126 + copy.append(singleItemLists[j]);
  127 +
115 128 i = nextTrainableTransform;
116 129 }
117 130 }
... ...
1   -Subproject commit c11ff0f0bb451fb5576bd4b8122c32278e52042a
  1 +Subproject commit 1394fbec42897c1a53373443c32a6f62a010294f
... ...