Commit 3bff52c049f4bf8d67de0106929edcd79d70a782

Authored by Charles Otto
1 parent 6a1f4fa5

Use File::subject rather than acccessing the property directly

Showing 1 changed file with 6 additions and 2 deletions
openbr/core/classify.cpp
@@ -45,8 +45,12 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI @@ -45,8 +45,12 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI
45 qFatal("Input order mismatch."); 45 qFatal("Input order mismatch.");
46 46
47 // Typically these lists will be of length one, but this generalization allows measuring multi-class labeling accuracy. 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 foreach (const QString &subject, trueSubjects.toVector() /* Hack to copy the list. */) { 54 foreach (const QString &subject, trueSubjects.toVector() /* Hack to copy the list. */) {
51 if (predictedSubjects.contains(subject)) { 55 if (predictedSubjects.contains(subject)) {
52 counters[subject].truePositive++; 56 counters[subject].truePositive++;