Commit 6a1fa9902b319ca4ebe08210a26ac6a71851257e

Authored by Charles Otto
1 parent a10dae59

Update Classifier::_classify to reflect changes to label handling

Showing 1 changed file with 9 additions and 5 deletions
openbr/gui/classifier.cpp
@@ -39,19 +39,23 @@ void Classifier::_classify(File file) @@ -39,19 +39,23 @@ void Classifier::_classify(File file)
39 { 39 {
40 QString key, value; 40 QString key, value;
41 foreach (const File &f, Enroll(file.flat(), File("[algorithm=" + algorithm + "]"))) { 41 foreach (const File &f, Enroll(file.flat(), File("[algorithm=" + algorithm + "]"))) {
42 - if (!f.contains("Label"))  
43 - continue;  
44 42
45 if (algorithm == "GenderClassification") { 43 if (algorithm == "GenderClassification") {
46 key = "Gender"; 44 key = "Gender";
47 - value = f.get<QString>(key);  
48 } else if (algorithm == "AgeRegression") { 45 } else if (algorithm == "AgeRegression") {
49 key = "Age"; 46 key = "Age";
50 - value = QString::number(int(f.get<float>(key)+0.5)) + " Years";  
51 } else { 47 } else {
52 key = algorithm; 48 key = algorithm;
53 - value = f.get<QString>("Label");  
54 } 49 }
  50 +
  51 + if (!f.contains(key))
  52 + continue;
  53 +
  54 + if (algorithm == "AgeRegression")
  55 + value = QString::number(int(f.get<float>(key)+0.5)) + " Years";
  56 + else
  57 + value = f.get<QString>(key);
  58 +
55 break; 59 break;
56 } 60 }
57 61