Commit 70a3c85b98843e848d0d07562138c77933c6f380

Authored by Charles Otto
1 parent 74b9008f

Update target variable names for age/gender prediction

app/examples/age_estimation.cpp
@@ -29,8 +29,7 @@ @@ -29,8 +29,7 @@
29 29
30 static void printTemplate(const br::Template &t) 30 static void printTemplate(const br::Template &t)
31 { 31 {
32 - // may use age directly -cao  
33 - printf("%s age: %d\n", qPrintable(t.file.fileName()), int(t.file.get<float>("Regressand"))); 32 + printf("%s age: %d\n", qPrintable(t.file.fileName()), int(t.file.get<float>("Age")));
34 } 33 }
35 34
36 int main(int argc, char *argv[]) 35 int main(int argc, char *argv[])
app/examples/gender_estimation.cpp
@@ -29,8 +29,7 @@ @@ -29,8 +29,7 @@
29 29
30 static void printTemplate(const br::Template &t) 30 static void printTemplate(const br::Template &t)
31 { 31 {
32 - // may use gender directly -cao  
33 - printf("%s gender: %s\n", qPrintable(t.file.fileName()), qPrintable(t.file.get<QString>("Label"))); 32 + printf("%s gender: %s\n", qPrintable(t.file.fileName()), qPrintable(t.file.get<QString>("Gender")));
34 } 33 }
35 34
36 int main(int argc, char *argv[]) 35 int main(int argc, char *argv[])
openbr/frvt2012.cpp
@@ -132,8 +132,7 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &amp;input_face, int32_t &amp;age) @@ -132,8 +132,7 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &amp;input_face, int32_t &amp;age)
132 TemplateList templates; 132 TemplateList templates;
133 templates.append(templateFromONEFACE(input_face)); 133 templates.append(templateFromONEFACE(input_face));
134 templates >> *frvt2012_age_transform.data(); 134 templates >> *frvt2012_age_transform.data();
135 - // should maybe use "Age" directly -cao  
136 - age = templates.first().file.get<float>("Regressand"); 135 + age = templates.first().file.get<float>("Age");
137 return templates.first().file.failed() ? 4 : 0; 136 return templates.first().file.failed() ? 4 : 0;
138 } 137 }
139 138
@@ -142,7 +141,6 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &amp;input_face, int8_t &amp;gender, @@ -142,7 +141,6 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &amp;input_face, int8_t &amp;gender,
142 TemplateList templates; 141 TemplateList templates;
143 templates.append(templateFromONEFACE(input_face)); 142 templates.append(templateFromONEFACE(input_face));
144 templates >> *frvt2012_gender_transform.data(); 143 templates >> *frvt2012_gender_transform.data();
145 - // Should maybe use "Gender" directly -cao  
146 - mf = gender = templates.first().file.get<QString>("Label") == "Male" ? 0 : 1; 144 + mf = gender = templates.first().file.get<QString>("Gender") == "Male" ? 0 : 1;
147 return templates.first().file.failed() ? 4 : 0; 145 return templates.first().file.failed() ? 4 : 0;
148 } 146 }
openbr/gui/classifier.cpp
@@ -43,13 +43,11 @@ void Classifier::_classify(File file) @@ -43,13 +43,11 @@ void Classifier::_classify(File file)
43 continue; 43 continue;
44 44
45 if (algorithm == "GenderClassification") { 45 if (algorithm == "GenderClassification") {
46 - // Should maybe use gender directly -cao  
47 key = "Gender"; 46 key = "Gender";
48 - value = f.get<QString>("Label"); 47 + value = f.get<QString>(key);
49 } else if (algorithm == "AgeRegression") { 48 } else if (algorithm == "AgeRegression") {
50 key = "Age"; 49 key = "Age";
51 - // similarly, age -cao  
52 - value = QString::number(int(f.get<float>("Regressand")+0.5)) + " Years"; 50 + value = QString::number(int(f.get<float>(key)+0.5)) + " Years";
53 } else { 51 } else {
54 key = algorithm; 52 key = algorithm;
55 value = f.get<QString>("Label"); 53 value = f.get<QString>("Label");
openbr/openbr.cpp
@@ -79,12 +79,7 @@ float br_eval(const char *simmat, const char *mask, const char *csv) @@ -79,12 +79,7 @@ float br_eval(const char *simmat, const char *mask, const char *csv)
79 79
80 void br_eval_classification(const char *predicted_input, const char *truth_input, const char *predicted_property, const char * truth_property) 80 void br_eval_classification(const char *predicted_input, const char *truth_input, const char *predicted_property, const char * truth_property)
81 { 81 {
82 - if (predicted_property && truth_property)  
83 - EvalClassification(predicted_input, truth_input, predicted_property, truth_property);  
84 - else if (predicted_property)  
85 - EvalClassification(predicted_input, truth_input, predicted_property);  
86 - else  
87 - EvalClassification(predicted_input, truth_input); 82 + EvalClassification(predicted_input, truth_input, predicted_property, truth_property);
88 } 83 }
89 84
90 void br_eval_clustering(const char *csv, const char *input) 85 void br_eval_clustering(const char *csv, const char *input)
@@ -92,9 +87,9 @@ void br_eval_clustering(const char *csv, const char *input) @@ -92,9 +87,9 @@ void br_eval_clustering(const char *csv, const char *input)
92 EvalClustering(csv, input); 87 EvalClustering(csv, input);
93 } 88 }
94 89
95 -void br_eval_regression(const char *predicted_input, const char *truth_input) 90 +void br_eval_regression(const char *predicted_input, const char *truth_input, const char * predicted_property, const char * truth_property)
96 { 91 {
97 - EvalRegression(predicted_input, truth_input); 92 + EvalRegression(predicted_input, truth_input, predicted_property, truth_property);
98 } 93 }
99 94
100 void br_finalize() 95 void br_finalize()
openbr/plugins/algorithms.cpp
@@ -75,8 +75,8 @@ class AlgorithmsInitializer : public Initializer @@ -75,8 +75,8 @@ class AlgorithmsInitializer : public Initializer
75 Globals->abbreviations.insert("FaceRecognitionQuantization", "(Normalize(L1)+Quantize)"); 75 Globals->abbreviations.insert("FaceRecognitionQuantization", "(Normalize(L1)+Quantize)");
76 Globals->abbreviations.insert("FaceClassificationRegistration", "(ASEFEyes+Affine(56,72,0.33,0.45)+FTE(DFFS))"); 76 Globals->abbreviations.insert("FaceClassificationRegistration", "(ASEFEyes+Affine(56,72,0.33,0.45)+FTE(DFFS))");
77 Globals->abbreviations.insert("FaceClassificationExtraction", "((Grid(7,7)+SIFTDescriptor(8)+ByRow)/DenseLBP+PCA(0.95,instances=-1)+Cat)"); 77 Globals->abbreviations.insert("FaceClassificationExtraction", "((Grid(7,7)+SIFTDescriptor(8)+ByRow)/DenseLBP+PCA(0.95,instances=-1)+Cat)");
78 - Globals->abbreviations.insert("AgeRegressor", "Center(Range,instances=-1)+SVM(RBF,EPS_SVR,instances=100)");  
79 - Globals->abbreviations.insert("GenderClassifier", "Center(Range,instances=-1)+SVM(RBF,C_SVC,instances=4000)"); 78 + Globals->abbreviations.insert("AgeRegressor", "Center(Range,instances=-1)+SVM(RBF,EPS_SVR,inputVariable=Age,instances=100)");
  79 + Globals->abbreviations.insert("GenderClassifier", "Center(Range,instances=-1)+SVM(RBF,C_SVC,inputVariable=Gender,instances=4000)");
80 Globals->abbreviations.insert("UCharL1", "Unit(ByteL1)"); 80 Globals->abbreviations.insert("UCharL1", "Unit(ByteL1)");
81 } 81 }
82 }; 82 };