From 70a3c85b98843e848d0d07562138c77933c6f380 Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Tue, 25 Jun 2013 21:10:07 -0400 Subject: [PATCH] Update target variable names for age/gender prediction --- app/examples/age_estimation.cpp | 3 +-- app/examples/gender_estimation.cpp | 3 +-- openbr/frvt2012.cpp | 6 ++---- openbr/gui/classifier.cpp | 6 ++---- openbr/openbr.cpp | 11 +++-------- openbr/plugins/algorithms.cpp | 4 ++-- 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/app/examples/age_estimation.cpp b/app/examples/age_estimation.cpp index 39c8252..2958b71 100644 --- a/app/examples/age_estimation.cpp +++ b/app/examples/age_estimation.cpp @@ -29,8 +29,7 @@ static void printTemplate(const br::Template &t) { - // may use age directly -cao - printf("%s age: %d\n", qPrintable(t.file.fileName()), int(t.file.get("Regressand"))); + printf("%s age: %d\n", qPrintable(t.file.fileName()), int(t.file.get("Age"))); } int main(int argc, char *argv[]) diff --git a/app/examples/gender_estimation.cpp b/app/examples/gender_estimation.cpp index c62d409..d2a824d 100644 --- a/app/examples/gender_estimation.cpp +++ b/app/examples/gender_estimation.cpp @@ -29,8 +29,7 @@ static void printTemplate(const br::Template &t) { - // may use gender directly -cao - printf("%s gender: %s\n", qPrintable(t.file.fileName()), qPrintable(t.file.get("Label"))); + printf("%s gender: %s\n", qPrintable(t.file.fileName()), qPrintable(t.file.get("Gender"))); } int main(int argc, char *argv[]) diff --git a/openbr/frvt2012.cpp b/openbr/frvt2012.cpp index 66bf6ae..b0c2d29 100644 --- a/openbr/frvt2012.cpp +++ b/openbr/frvt2012.cpp @@ -132,8 +132,7 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &input_face, int32_t &age) TemplateList templates; templates.append(templateFromONEFACE(input_face)); templates >> *frvt2012_age_transform.data(); - // should maybe use "Age" directly -cao - age = templates.first().file.get("Regressand"); + age = templates.first().file.get("Age"); return templates.first().file.failed() ? 4 : 0; } @@ -142,7 +141,6 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &input_face, int8_t &gender, TemplateList templates; templates.append(templateFromONEFACE(input_face)); templates >> *frvt2012_gender_transform.data(); - // Should maybe use "Gender" directly -cao - mf = gender = templates.first().file.get("Label") == "Male" ? 0 : 1; + mf = gender = templates.first().file.get("Gender") == "Male" ? 0 : 1; return templates.first().file.failed() ? 4 : 0; } diff --git a/openbr/gui/classifier.cpp b/openbr/gui/classifier.cpp index 6ff945f..8dcf0c6 100644 --- a/openbr/gui/classifier.cpp +++ b/openbr/gui/classifier.cpp @@ -43,13 +43,11 @@ void Classifier::_classify(File file) continue; if (algorithm == "GenderClassification") { - // Should maybe use gender directly -cao key = "Gender"; - value = f.get("Label"); + value = f.get(key); } else if (algorithm == "AgeRegression") { key = "Age"; - // similarly, age -cao - value = QString::number(int(f.get("Regressand")+0.5)) + " Years"; + value = QString::number(int(f.get(key)+0.5)) + " Years"; } else { key = algorithm; value = f.get("Label"); diff --git a/openbr/openbr.cpp b/openbr/openbr.cpp index 5217ebd..c216e93 100644 --- a/openbr/openbr.cpp +++ b/openbr/openbr.cpp @@ -79,12 +79,7 @@ float br_eval(const char *simmat, const char *mask, const char *csv) void br_eval_classification(const char *predicted_input, const char *truth_input, const char *predicted_property, const char * truth_property) { - if (predicted_property && truth_property) - EvalClassification(predicted_input, truth_input, predicted_property, truth_property); - else if (predicted_property) - EvalClassification(predicted_input, truth_input, predicted_property); - else - EvalClassification(predicted_input, truth_input); + EvalClassification(predicted_input, truth_input, predicted_property, truth_property); } void br_eval_clustering(const char *csv, const char *input) @@ -92,9 +87,9 @@ void br_eval_clustering(const char *csv, const char *input) EvalClustering(csv, input); } -void br_eval_regression(const char *predicted_input, const char *truth_input) +void br_eval_regression(const char *predicted_input, const char *truth_input, const char * predicted_property, const char * truth_property) { - EvalRegression(predicted_input, truth_input); + EvalRegression(predicted_input, truth_input, predicted_property, truth_property); } void br_finalize() diff --git a/openbr/plugins/algorithms.cpp b/openbr/plugins/algorithms.cpp index 2b3f270..99abb95 100644 --- a/openbr/plugins/algorithms.cpp +++ b/openbr/plugins/algorithms.cpp @@ -75,8 +75,8 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("FaceRecognitionQuantization", "(Normalize(L1)+Quantize)"); Globals->abbreviations.insert("FaceClassificationRegistration", "(ASEFEyes+Affine(56,72,0.33,0.45)+FTE(DFFS))"); Globals->abbreviations.insert("FaceClassificationExtraction", "((Grid(7,7)+SIFTDescriptor(8)+ByRow)/DenseLBP+PCA(0.95,instances=-1)+Cat)"); - Globals->abbreviations.insert("AgeRegressor", "Center(Range,instances=-1)+SVM(RBF,EPS_SVR,instances=100)"); - Globals->abbreviations.insert("GenderClassifier", "Center(Range,instances=-1)+SVM(RBF,C_SVC,instances=4000)"); + Globals->abbreviations.insert("AgeRegressor", "Center(Range,instances=-1)+SVM(RBF,EPS_SVR,inputVariable=Age,instances=100)"); + Globals->abbreviations.insert("GenderClassifier", "Center(Range,instances=-1)+SVM(RBF,C_SVC,inputVariable=Gender,instances=4000)"); Globals->abbreviations.insert("UCharL1", "Unit(ByteL1)"); } }; -- libgit2 0.21.4