diff --git a/app/examples/compare_faces.cpp b/app/examples/compare_faces.cpp index 307fe56..e5d80b7 100644 --- a/app/examples/compare_faces.cpp +++ b/app/examples/compare_faces.cpp @@ -19,7 +19,7 @@ * \page cli_compare_faces Compare Faces * \ref cpp_compare_faces "Source Equivalent" * \code - * $ br -algorithm FaceRecognition -forceEnrollment \ + * $ br -algorithm FaceRecognition \ * -compare ../share/openbr/images/S354-01-t10_01.jpg ../share/openbr/images/S354-02-t10_01.jpg \ * -compare ../share/openbr/images/S024-01-t10_01.jpg ../share/openbr/images/S354-02-t10_01.jpg * \endcode @@ -32,9 +32,6 @@ int main(int argc, char *argv[]) { br::Context::initialize(argc, argv); - // Enroll exactly one template per image - br::Globals->forceEnrollment = true; - // Retrieve classes for enrolling and comparing templates using the FaceRecognition algorithm QSharedPointer transform = br::Transform::fromAlgorithm("FaceRecognition"); QSharedPointer distance = br::Distance::fromAlgorithm("FaceRecognition"); diff --git a/app/examples/evaluate_face_recognition.cpp b/app/examples/evaluate_face_recognition.cpp index f5780b4..1c4ad4b 100644 --- a/app/examples/evaluate_face_recognition.cpp +++ b/app/examples/evaluate_face_recognition.cpp @@ -19,7 +19,7 @@ * \page cli_evaluate_face_recognition Evaluate Face Recognition * \ref c_evaluate_face_recognition "Source Equivalent" * \code - * $ br -algorithm FaceRecognition -forceEnrollment -path ../share/openbr/images/ \ + * $ br -algorithm FaceRecognition -path ../share/openbr/images/ \ * -enroll ../data/MEDS/sigset/MEDS_frontal_target.xml target.gal \ * -enroll ../data/MEDS/sigset/MEDS_frontal_query.xml query.gal \ * -compare target.gal query.gal scores.mtx \ @@ -40,9 +40,6 @@ int main(int argc, char *argv[]) // Equivalent to 'Globals->algorithm = "FaceRecognion";' in C++ API br_set_property("algorithm", "FaceRecognition"); - // Equivalent to 'Globals->forceEnrollment = true;' in C++ API - br_set_property("forceEnrollment", "true"); - // Equivalent to 'Globals->path = "../data/MEDS/img/";' in C++ API br_set_property("path", "../data/MEDS/img/"); diff --git a/app/openbr-gui/classifier.cpp b/app/openbr-gui/classifier.cpp index a5c6ca3..481950c 100644 --- a/app/openbr-gui/classifier.cpp +++ b/app/openbr-gui/classifier.cpp @@ -37,8 +37,6 @@ void Classifier::setClassification(const QString &key, const QString &value) /*** PRIVATE ***/ void Classifier::_classify(File file) { - file.setBool("forceEnrollment"); - QString key, value; foreach (const File &f, Enroll(file.flat(), File("[algorithm=" + algorithm + "]"))) { qDebug() << f.flat(); diff --git a/app/openbr-gui/gallerytoolbar.cpp b/app/openbr-gui/gallerytoolbar.cpp index 8c27f74..b26ea3a 100644 --- a/app/openbr-gui/gallerytoolbar.cpp +++ b/app/openbr-gui/gallerytoolbar.cpp @@ -117,7 +117,7 @@ void br::GalleryToolBar::checkWebcam() void br::GalleryToolBar::enrollmentFinished() { if (files.isEmpty()) { - if (!input.getBool("forceEnrollment") && !tbWebcam.isChecked()) { + if (input.getBool("enrollAll") && !tbWebcam.isChecked()) { QMessageBox msgBox; msgBox.setText("Quality test failed."); msgBox.setInformativeText("Enroll anyway?"); @@ -127,7 +127,7 @@ void br::GalleryToolBar::enrollmentFinished() if (ret == QMessageBox::Ok) { br::File file = input; - file.setBool("forceEnrollment"); + file.setBool("enrollAll", false); enroll(file); } } @@ -151,7 +151,6 @@ void br::GalleryToolBar::mean() const QString file = QString("%1/mean/%2.png").arg(br_scratch_path(), input.baseName()+input.hash()); br_set_property("CENTER_TRAIN_B", qPrintable(file)); br::File trainingFile = input; - trainingFile.setBool("forceEnrollment"); br_train(qPrintable(trainingFile.flat()), "[algorithm=MedianFace]"); enroll(file); } diff --git a/app/openbr-gui/templateviewer.cpp b/app/openbr-gui/templateviewer.cpp index eaafd55..b8843f7 100644 --- a/app/openbr-gui/templateviewer.cpp +++ b/app/openbr-gui/templateviewer.cpp @@ -212,7 +212,7 @@ void TemplateViewer::mousePressEvent(QMouseEvent *event) landmarks[index] = getImagePoint(event->pos()); qSort(landmarks.begin(), landmarks.end(), lessThan); if (!landmarks.contains(QPointF())) - emit selectedInput(file.name+QString("[Affine_0_X=%1, Affine_0_Y=%2, Affine_1_X=%3, Affine_1_Y=%4, forceEnrollment]").arg(QString::number(landmarks[0].x()), + emit selectedInput(file.name+QString("[Affine_0_X=%1, Affine_0_Y=%2, Affine_1_X=%3, Affine_1_Y=%4]").arg(QString::number(landmarks[0].x()), QString::number(landmarks[0].y()), QString::number(landmarks[1].x()), QString::number(landmarks[1].y()))); diff --git a/scripts/evalFaceRecognition-MEDS.sh b/scripts/evalFaceRecognition-MEDS.sh index 7ff49d9..bfb2156 100755 --- a/scripts/evalFaceRecognition-MEDS.sh +++ b/scripts/evalFaceRecognition-MEDS.sh @@ -16,7 +16,7 @@ if [ ! -e MEDS.mask ]; then fi # Run Algorithm on MEDS -br -algorithm ${ALGORITHM} -forceEnrollment -path ../data/MEDS/img -compare ../data/MEDS/sigset/MEDS_frontal_target.xml ../data/MEDS/sigset/MEDS_frontal_query.xml ${ALGORITHM}_MEDS.mtx -eval ${ALGORITHM}_MEDS.mtx MEDS.mask Algorithm_Dataset/${ALGORITHM}_MEDS.csv +br -algorithm ${ALGORITHM} -path ../data/MEDS/img -compare ../data/MEDS/sigset/MEDS_frontal_target.xml ../data/MEDS/sigset/MEDS_frontal_query.xml ${ALGORITHM}_MEDS.mtx -eval ${ALGORITHM}_MEDS.mtx MEDS.mask Algorithm_Dataset/${ALGORITHM}_MEDS.csv # Evaluate other algorithms for ALGORITHM in COTS diff --git a/sdk/frvt2012.cpp b/sdk/frvt2012.cpp index 7929a5a..5be9f82 100644 --- a/sdk/frvt2012.cpp +++ b/sdk/frvt2012.cpp @@ -30,7 +30,6 @@ static const int frvt2012_template_size = 768; static void initialize(const string &configuration_location) { if (Globals == NULL) Context::initialize(0, NULL, QString::fromStdString(configuration_location)); - Globals->forceEnrollment = true; Globals->quiet = true; Globals->parallelism = 0; } @@ -126,7 +125,6 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &input_face, int32_t &age) { TemplateList templates; templates.append(templateFromONEFACE(input_face)); - templates.first().file.setBool("forceEnrollment"); templates >> *frvt2012_age_transform.data(); age = templates.first().file.label(); return templates.first().file.failed() ? 4 : 0; @@ -136,7 +134,6 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &input_face, int8_t &gender, { TemplateList templates; templates.append(templateFromONEFACE(input_face)); - templates.first().file.setBool("forceEnrollment"); templates >> *frvt2012_gender_transform.data(); mf = gender = templates.first().file.label(); return templates.first().file.failed() ? 4 : 0; diff --git a/sdk/openbr_plugin.cpp b/sdk/openbr_plugin.cpp index 001c0db..994422d 100644 --- a/sdk/openbr_plugin.cpp +++ b/sdk/openbr_plugin.cpp @@ -605,7 +605,7 @@ br::Context::Context() blockSize = parallelism * ((sizeof(void*) == 4) ? 128 : 1024); profiling = quiet = verbose = false; currentStep = totalSteps = 0; - forceEnrollment = false; + enrollAll = false; } int br::Context::blocks(int size) const diff --git a/sdk/openbr_plugin.h b/sdk/openbr_plugin.h index 71bf954..f9c15e8 100644 --- a/sdk/openbr_plugin.h +++ b/sdk/openbr_plugin.h @@ -117,7 +117,7 @@ void reset_##NAME() { NAME = DEFAULT; } * Key | Value | Description * --- | ---- | ----------- * path | QString | Resolve complete file paths from file names - * forceEnrollment | bool | Enroll exactly one template per file + * enrollAll | bool | Enroll zero or more templates per file * separator | QString | Sperate #name into multiple files * Input_Index | int | Index of a template in a template list * Label | float | Classification/Regression class @@ -424,7 +424,7 @@ public: Q_PROPERTY(QString mostRecentMessage READ get_mostRecentMessage WRITE set_mostRecentMessage RESET reset_mostRecentMessage) Q_PROPERTY(double currentStep READ get_currentStep WRITE set_currentStep RESET reset_currentStep) Q_PROPERTY(double totalSteps READ get_totalSteps WRITE set_totalSteps RESET reset_totalSteps) - Q_PROPERTY(bool forceEnrollment READ get_forceEnrollment WRITE set_forceEnrollment RESET reset_forceEnrollment) + Q_PROPERTY(bool enrollAll READ get_enrollAll WRITE set_enrollAll RESET reset_enrollAll) BR_PROPERTY(QString, sdkPath, "") BR_PROPERTY(QString, algorithm, "") BR_PROPERTY(QString, log, "") @@ -437,7 +437,7 @@ public: BR_PROPERTY(QString, mostRecentMessage, "") BR_PROPERTY(double, currentStep, 0) BR_PROPERTY(double, totalSteps, 0) - BR_PROPERTY(bool, forceEnrollment, false) + BR_PROPERTY(bool, enrollAll, false) QHash abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ QHash classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */ diff --git a/sdk/plugins/cascade.cpp b/sdk/plugins/cascade.cpp index 18d171f..ab81aef 100644 --- a/sdk/plugins/cascade.cpp +++ b/sdk/plugins/cascade.cpp @@ -74,10 +74,10 @@ class Cascade : public UntrainableTransform { CascadeClassifier *cascade = cascadeResource.acquire(); vector rects; - cascade->detectMultiScale(src, rects, 1.2, 5, src.file.getBool("forceEnrollment") ? CV_HAAR_FIND_BIGGEST_OBJECT : 0, Size(minSize, minSize)); + cascade->detectMultiScale(src, rects, 1.2, 5, src.file.getBool("enrollAll") ? 0 : CV_HAAR_FIND_BIGGEST_OBJECT, Size(minSize, minSize)); cascadeResource.release(cascade); - if (src.file.getBool("forceEnrollment") && rects.empty()) + if (!src.file.getBool("enrollAll") && rects.empty()) rects.push_back(Rect(0, 0, src.m().cols, src.m().rows)); foreach (const Rect &rect, rects) { diff --git a/sdk/plugins/meta.cpp b/sdk/plugins/meta.cpp index 1f99ccb..f6240bb 100644 --- a/sdk/plugins/meta.cpp +++ b/sdk/plugins/meta.cpp @@ -29,7 +29,7 @@ static TemplateList Simplified(const TemplateList &templates) TemplateList simplified; foreach (const Template &t, templates) { if (t.isEmpty()) { - if (t.file.getBool("forceEnrollment")) + if (!t.file.getBool("enrollAll")) simplified.append(t); continue; } @@ -43,7 +43,7 @@ static TemplateList Simplified(const TemplateList &templates) const int ROIStep = ROIs.size() / t.size(); for (int i=0; i