Commit 3b3275487065ff4329afebdadc1084e367c5a0c4
1 parent
551b7c4f
forceEnrollment -> enrollAll
Showing
11 changed files
with
14 additions
and
26 deletions
app/examples/compare_faces.cpp
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | * \page cli_compare_faces Compare Faces | 19 | * \page cli_compare_faces Compare Faces |
| 20 | * \ref cpp_compare_faces "Source Equivalent" | 20 | * \ref cpp_compare_faces "Source Equivalent" |
| 21 | * \code | 21 | * \code |
| 22 | - * $ br -algorithm FaceRecognition -forceEnrollment \ | 22 | + * $ br -algorithm FaceRecognition \ |
| 23 | * -compare ../share/openbr/images/S354-01-t10_01.jpg ../share/openbr/images/S354-02-t10_01.jpg \ | 23 | * -compare ../share/openbr/images/S354-01-t10_01.jpg ../share/openbr/images/S354-02-t10_01.jpg \ |
| 24 | * -compare ../share/openbr/images/S024-01-t10_01.jpg ../share/openbr/images/S354-02-t10_01.jpg | 24 | * -compare ../share/openbr/images/S024-01-t10_01.jpg ../share/openbr/images/S354-02-t10_01.jpg |
| 25 | * \endcode | 25 | * \endcode |
| @@ -32,9 +32,6 @@ int main(int argc, char *argv[]) | @@ -32,9 +32,6 @@ int main(int argc, char *argv[]) | ||
| 32 | { | 32 | { |
| 33 | br::Context::initialize(argc, argv); | 33 | br::Context::initialize(argc, argv); |
| 34 | 34 | ||
| 35 | - // Enroll exactly one template per image | ||
| 36 | - br::Globals->forceEnrollment = true; | ||
| 37 | - | ||
| 38 | // Retrieve classes for enrolling and comparing templates using the FaceRecognition algorithm | 35 | // Retrieve classes for enrolling and comparing templates using the FaceRecognition algorithm |
| 39 | QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("FaceRecognition"); | 36 | QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("FaceRecognition"); |
| 40 | QSharedPointer<br::Distance> distance = br::Distance::fromAlgorithm("FaceRecognition"); | 37 | QSharedPointer<br::Distance> distance = br::Distance::fromAlgorithm("FaceRecognition"); |
app/examples/evaluate_face_recognition.cpp
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | * \page cli_evaluate_face_recognition Evaluate Face Recognition | 19 | * \page cli_evaluate_face_recognition Evaluate Face Recognition |
| 20 | * \ref c_evaluate_face_recognition "Source Equivalent" | 20 | * \ref c_evaluate_face_recognition "Source Equivalent" |
| 21 | * \code | 21 | * \code |
| 22 | - * $ br -algorithm FaceRecognition -forceEnrollment -path ../share/openbr/images/ \ | 22 | + * $ br -algorithm FaceRecognition -path ../share/openbr/images/ \ |
| 23 | * -enroll ../data/MEDS/sigset/MEDS_frontal_target.xml target.gal \ | 23 | * -enroll ../data/MEDS/sigset/MEDS_frontal_target.xml target.gal \ |
| 24 | * -enroll ../data/MEDS/sigset/MEDS_frontal_query.xml query.gal \ | 24 | * -enroll ../data/MEDS/sigset/MEDS_frontal_query.xml query.gal \ |
| 25 | * -compare target.gal query.gal scores.mtx \ | 25 | * -compare target.gal query.gal scores.mtx \ |
| @@ -40,9 +40,6 @@ int main(int argc, char *argv[]) | @@ -40,9 +40,6 @@ int main(int argc, char *argv[]) | ||
| 40 | // Equivalent to 'Globals->algorithm = "FaceRecognion";' in C++ API | 40 | // Equivalent to 'Globals->algorithm = "FaceRecognion";' in C++ API |
| 41 | br_set_property("algorithm", "FaceRecognition"); | 41 | br_set_property("algorithm", "FaceRecognition"); |
| 42 | 42 | ||
| 43 | - // Equivalent to 'Globals->forceEnrollment = true;' in C++ API | ||
| 44 | - br_set_property("forceEnrollment", "true"); | ||
| 45 | - | ||
| 46 | // Equivalent to 'Globals->path = "../data/MEDS/img/";' in C++ API | 43 | // Equivalent to 'Globals->path = "../data/MEDS/img/";' in C++ API |
| 47 | br_set_property("path", "../data/MEDS/img/"); | 44 | br_set_property("path", "../data/MEDS/img/"); |
| 48 | 45 |
app/openbr-gui/classifier.cpp
| @@ -37,8 +37,6 @@ void Classifier::setClassification(const QString &key, const QString &value) | @@ -37,8 +37,6 @@ void Classifier::setClassification(const QString &key, const QString &value) | ||
| 37 | /*** PRIVATE ***/ | 37 | /*** PRIVATE ***/ |
| 38 | void Classifier::_classify(File file) | 38 | void Classifier::_classify(File file) |
| 39 | { | 39 | { |
| 40 | - file.setBool("forceEnrollment"); | ||
| 41 | - | ||
| 42 | QString key, value; | 40 | QString key, value; |
| 43 | foreach (const File &f, Enroll(file.flat(), File("[algorithm=" + algorithm + "]"))) { | 41 | foreach (const File &f, Enroll(file.flat(), File("[algorithm=" + algorithm + "]"))) { |
| 44 | qDebug() << f.flat(); | 42 | qDebug() << f.flat(); |
app/openbr-gui/gallerytoolbar.cpp
| @@ -117,7 +117,7 @@ void br::GalleryToolBar::checkWebcam() | @@ -117,7 +117,7 @@ void br::GalleryToolBar::checkWebcam() | ||
| 117 | void br::GalleryToolBar::enrollmentFinished() | 117 | void br::GalleryToolBar::enrollmentFinished() |
| 118 | { | 118 | { |
| 119 | if (files.isEmpty()) { | 119 | if (files.isEmpty()) { |
| 120 | - if (!input.getBool("forceEnrollment") && !tbWebcam.isChecked()) { | 120 | + if (input.getBool("enrollAll") && !tbWebcam.isChecked()) { |
| 121 | QMessageBox msgBox; | 121 | QMessageBox msgBox; |
| 122 | msgBox.setText("Quality test failed."); | 122 | msgBox.setText("Quality test failed."); |
| 123 | msgBox.setInformativeText("Enroll anyway?"); | 123 | msgBox.setInformativeText("Enroll anyway?"); |
| @@ -127,7 +127,7 @@ void br::GalleryToolBar::enrollmentFinished() | @@ -127,7 +127,7 @@ void br::GalleryToolBar::enrollmentFinished() | ||
| 127 | 127 | ||
| 128 | if (ret == QMessageBox::Ok) { | 128 | if (ret == QMessageBox::Ok) { |
| 129 | br::File file = input; | 129 | br::File file = input; |
| 130 | - file.setBool("forceEnrollment"); | 130 | + file.setBool("enrollAll", false); |
| 131 | enroll(file); | 131 | enroll(file); |
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| @@ -151,7 +151,6 @@ void br::GalleryToolBar::mean() | @@ -151,7 +151,6 @@ void br::GalleryToolBar::mean() | ||
| 151 | const QString file = QString("%1/mean/%2.png").arg(br_scratch_path(), input.baseName()+input.hash()); | 151 | const QString file = QString("%1/mean/%2.png").arg(br_scratch_path(), input.baseName()+input.hash()); |
| 152 | br_set_property("CENTER_TRAIN_B", qPrintable(file)); | 152 | br_set_property("CENTER_TRAIN_B", qPrintable(file)); |
| 153 | br::File trainingFile = input; | 153 | br::File trainingFile = input; |
| 154 | - trainingFile.setBool("forceEnrollment"); | ||
| 155 | br_train(qPrintable(trainingFile.flat()), "[algorithm=MedianFace]"); | 154 | br_train(qPrintable(trainingFile.flat()), "[algorithm=MedianFace]"); |
| 156 | enroll(file); | 155 | enroll(file); |
| 157 | } | 156 | } |
app/openbr-gui/templateviewer.cpp
| @@ -212,7 +212,7 @@ void TemplateViewer::mousePressEvent(QMouseEvent *event) | @@ -212,7 +212,7 @@ void TemplateViewer::mousePressEvent(QMouseEvent *event) | ||
| 212 | landmarks[index] = getImagePoint(event->pos()); | 212 | landmarks[index] = getImagePoint(event->pos()); |
| 213 | qSort(landmarks.begin(), landmarks.end(), lessThan); | 213 | qSort(landmarks.begin(), landmarks.end(), lessThan); |
| 214 | if (!landmarks.contains(QPointF())) | 214 | if (!landmarks.contains(QPointF())) |
| 215 | - 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()), | 215 | + 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()), |
| 216 | QString::number(landmarks[0].y()), | 216 | QString::number(landmarks[0].y()), |
| 217 | QString::number(landmarks[1].x()), | 217 | QString::number(landmarks[1].x()), |
| 218 | QString::number(landmarks[1].y()))); | 218 | QString::number(landmarks[1].y()))); |
scripts/evalFaceRecognition-MEDS.sh
| @@ -16,7 +16,7 @@ if [ ! -e MEDS.mask ]; then | @@ -16,7 +16,7 @@ if [ ! -e MEDS.mask ]; then | ||
| 16 | fi | 16 | fi |
| 17 | 17 | ||
| 18 | # Run Algorithm on MEDS | 18 | # Run Algorithm on MEDS |
| 19 | -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 | 19 | +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 |
| 20 | 20 | ||
| 21 | # Evaluate other algorithms | 21 | # Evaluate other algorithms |
| 22 | for ALGORITHM in COTS | 22 | for ALGORITHM in COTS |
sdk/frvt2012.cpp
| @@ -30,7 +30,6 @@ static const int frvt2012_template_size = 768; | @@ -30,7 +30,6 @@ static const int frvt2012_template_size = 768; | ||
| 30 | static void initialize(const string &configuration_location) | 30 | static void initialize(const string &configuration_location) |
| 31 | { | 31 | { |
| 32 | if (Globals == NULL) Context::initialize(0, NULL, QString::fromStdString(configuration_location)); | 32 | if (Globals == NULL) Context::initialize(0, NULL, QString::fromStdString(configuration_location)); |
| 33 | - Globals->forceEnrollment = true; | ||
| 34 | Globals->quiet = true; | 33 | Globals->quiet = true; |
| 35 | Globals->parallelism = 0; | 34 | Globals->parallelism = 0; |
| 36 | } | 35 | } |
| @@ -126,7 +125,6 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &input_face, int32_t &age) | @@ -126,7 +125,6 @@ int32_t SdkEstimator::estimate_age(const ONEFACE &input_face, int32_t &age) | ||
| 126 | { | 125 | { |
| 127 | TemplateList templates; | 126 | TemplateList templates; |
| 128 | templates.append(templateFromONEFACE(input_face)); | 127 | templates.append(templateFromONEFACE(input_face)); |
| 129 | - templates.first().file.setBool("forceEnrollment"); | ||
| 130 | templates >> *frvt2012_age_transform.data(); | 128 | templates >> *frvt2012_age_transform.data(); |
| 131 | age = templates.first().file.label(); | 129 | age = templates.first().file.label(); |
| 132 | return templates.first().file.failed() ? 4 : 0; | 130 | return templates.first().file.failed() ? 4 : 0; |
| @@ -136,7 +134,6 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &input_face, int8_t &gender, | @@ -136,7 +134,6 @@ int32_t SdkEstimator::estimate_gender(const ONEFACE &input_face, int8_t &gender, | ||
| 136 | { | 134 | { |
| 137 | TemplateList templates; | 135 | TemplateList templates; |
| 138 | templates.append(templateFromONEFACE(input_face)); | 136 | templates.append(templateFromONEFACE(input_face)); |
| 139 | - templates.first().file.setBool("forceEnrollment"); | ||
| 140 | templates >> *frvt2012_gender_transform.data(); | 137 | templates >> *frvt2012_gender_transform.data(); |
| 141 | mf = gender = templates.first().file.label(); | 138 | mf = gender = templates.first().file.label(); |
| 142 | return templates.first().file.failed() ? 4 : 0; | 139 | return templates.first().file.failed() ? 4 : 0; |
sdk/openbr_plugin.cpp
| @@ -605,7 +605,7 @@ br::Context::Context() | @@ -605,7 +605,7 @@ br::Context::Context() | ||
| 605 | blockSize = parallelism * ((sizeof(void*) == 4) ? 128 : 1024); | 605 | blockSize = parallelism * ((sizeof(void*) == 4) ? 128 : 1024); |
| 606 | profiling = quiet = verbose = false; | 606 | profiling = quiet = verbose = false; |
| 607 | currentStep = totalSteps = 0; | 607 | currentStep = totalSteps = 0; |
| 608 | - forceEnrollment = false; | 608 | + enrollAll = false; |
| 609 | } | 609 | } |
| 610 | 610 | ||
| 611 | int br::Context::blocks(int size) const | 611 | int br::Context::blocks(int size) const |
sdk/openbr_plugin.h
| @@ -117,7 +117,7 @@ void reset_##NAME() { NAME = DEFAULT; } | @@ -117,7 +117,7 @@ void reset_##NAME() { NAME = DEFAULT; } | ||
| 117 | * Key | Value | Description | 117 | * Key | Value | Description |
| 118 | * --- | ---- | ----------- | 118 | * --- | ---- | ----------- |
| 119 | * path | QString | Resolve complete file paths from file names | 119 | * path | QString | Resolve complete file paths from file names |
| 120 | - * forceEnrollment | bool | Enroll exactly one template per file | 120 | + * enrollAll | bool | Enroll zero or more templates per file |
| 121 | * separator | QString | Sperate #name into multiple files | 121 | * separator | QString | Sperate #name into multiple files |
| 122 | * Input_Index | int | Index of a template in a template list | 122 | * Input_Index | int | Index of a template in a template list |
| 123 | * Label | float | Classification/Regression class | 123 | * Label | float | Classification/Regression class |
| @@ -424,7 +424,7 @@ public: | @@ -424,7 +424,7 @@ public: | ||
| 424 | Q_PROPERTY(QString mostRecentMessage READ get_mostRecentMessage WRITE set_mostRecentMessage RESET reset_mostRecentMessage) | 424 | Q_PROPERTY(QString mostRecentMessage READ get_mostRecentMessage WRITE set_mostRecentMessage RESET reset_mostRecentMessage) |
| 425 | Q_PROPERTY(double currentStep READ get_currentStep WRITE set_currentStep RESET reset_currentStep) | 425 | Q_PROPERTY(double currentStep READ get_currentStep WRITE set_currentStep RESET reset_currentStep) |
| 426 | Q_PROPERTY(double totalSteps READ get_totalSteps WRITE set_totalSteps RESET reset_totalSteps) | 426 | Q_PROPERTY(double totalSteps READ get_totalSteps WRITE set_totalSteps RESET reset_totalSteps) |
| 427 | - Q_PROPERTY(bool forceEnrollment READ get_forceEnrollment WRITE set_forceEnrollment RESET reset_forceEnrollment) | 427 | + Q_PROPERTY(bool enrollAll READ get_enrollAll WRITE set_enrollAll RESET reset_enrollAll) |
| 428 | BR_PROPERTY(QString, sdkPath, "") | 428 | BR_PROPERTY(QString, sdkPath, "") |
| 429 | BR_PROPERTY(QString, algorithm, "") | 429 | BR_PROPERTY(QString, algorithm, "") |
| 430 | BR_PROPERTY(QString, log, "") | 430 | BR_PROPERTY(QString, log, "") |
| @@ -437,7 +437,7 @@ public: | @@ -437,7 +437,7 @@ public: | ||
| 437 | BR_PROPERTY(QString, mostRecentMessage, "") | 437 | BR_PROPERTY(QString, mostRecentMessage, "") |
| 438 | BR_PROPERTY(double, currentStep, 0) | 438 | BR_PROPERTY(double, currentStep, 0) |
| 439 | BR_PROPERTY(double, totalSteps, 0) | 439 | BR_PROPERTY(double, totalSteps, 0) |
| 440 | - BR_PROPERTY(bool, forceEnrollment, false) | 440 | + BR_PROPERTY(bool, enrollAll, false) |
| 441 | 441 | ||
| 442 | QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ | 442 | QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ |
| 443 | QHash<QString,int> classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */ | 443 | QHash<QString,int> classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */ |
sdk/plugins/cascade.cpp
| @@ -74,10 +74,10 @@ class Cascade : public UntrainableTransform | @@ -74,10 +74,10 @@ class Cascade : public UntrainableTransform | ||
| 74 | { | 74 | { |
| 75 | CascadeClassifier *cascade = cascadeResource.acquire(); | 75 | CascadeClassifier *cascade = cascadeResource.acquire(); |
| 76 | vector<Rect> rects; | 76 | vector<Rect> rects; |
| 77 | - cascade->detectMultiScale(src, rects, 1.2, 5, src.file.getBool("forceEnrollment") ? CV_HAAR_FIND_BIGGEST_OBJECT : 0, Size(minSize, minSize)); | 77 | + cascade->detectMultiScale(src, rects, 1.2, 5, src.file.getBool("enrollAll") ? 0 : CV_HAAR_FIND_BIGGEST_OBJECT, Size(minSize, minSize)); |
| 78 | cascadeResource.release(cascade); | 78 | cascadeResource.release(cascade); |
| 79 | 79 | ||
| 80 | - if (src.file.getBool("forceEnrollment") && rects.empty()) | 80 | + if (!src.file.getBool("enrollAll") && rects.empty()) |
| 81 | rects.push_back(Rect(0, 0, src.m().cols, src.m().rows)); | 81 | rects.push_back(Rect(0, 0, src.m().cols, src.m().rows)); |
| 82 | 82 | ||
| 83 | foreach (const Rect &rect, rects) { | 83 | foreach (const Rect &rect, rects) { |
sdk/plugins/meta.cpp
| @@ -29,7 +29,7 @@ static TemplateList Simplified(const TemplateList &templates) | @@ -29,7 +29,7 @@ static TemplateList Simplified(const TemplateList &templates) | ||
| 29 | TemplateList simplified; | 29 | TemplateList simplified; |
| 30 | foreach (const Template &t, templates) { | 30 | foreach (const Template &t, templates) { |
| 31 | if (t.isEmpty()) { | 31 | if (t.isEmpty()) { |
| 32 | - if (t.file.getBool("forceEnrollment")) | 32 | + if (!t.file.getBool("enrollAll")) |
| 33 | simplified.append(t); | 33 | simplified.append(t); |
| 34 | continue; | 34 | continue; |
| 35 | } | 35 | } |
| @@ -43,7 +43,7 @@ static TemplateList Simplified(const TemplateList &templates) | @@ -43,7 +43,7 @@ static TemplateList Simplified(const TemplateList &templates) | ||
| 43 | const int ROIStep = ROIs.size() / t.size(); | 43 | const int ROIStep = ROIs.size() / t.size(); |
| 44 | 44 | ||
| 45 | for (int i=0; i<t.size(); i++) { | 45 | for (int i=0; i<t.size(); i++) { |
| 46 | - if (!fte || t.file.getBool("forceEnrollment")) { | 46 | + if (!fte || !t.file.getBool("enrollAll")) { |
| 47 | simplified.append(Template(t.file, t[i])); | 47 | simplified.append(Template(t.file, t[i])); |
| 48 | simplified.last().file.setROIs(ROIs.mid(i*ROIStep, ROIStep)); | 48 | simplified.last().file.setROIs(ROIs.mid(i*ROIStep, ROIStep)); |
| 49 | simplified.last().file.setLandmarks(landmarks.mid(i*landmarkStep, landmarkStep)); | 49 | simplified.last().file.setLandmarks(landmarks.mid(i*landmarkStep, landmarkStep)); |