Commit 9b2cfd5b75c60d64c85ffacfefdf7ceae3e730f3
1 parent
e67fca6c
Premerge commit
Showing
6 changed files
with
17 additions
and
13 deletions
openbr/core/bee.cpp
| @@ -265,6 +265,9 @@ cv::Mat BEE::makeMask(const br::FileList &targets, const br::FileList &queries, | @@ -265,6 +265,9 @@ cv::Mat BEE::makeMask(const br::FileList &targets, const br::FileList &queries, | ||
| 265 | QList<int> targetPartitions = targets.crossValidationPartitions(); | 265 | QList<int> targetPartitions = targets.crossValidationPartitions(); |
| 266 | QList<int> queryPartitions = queries.crossValidationPartitions(); | 266 | QList<int> queryPartitions = queries.crossValidationPartitions(); |
| 267 | 267 | ||
| 268 | + for (int i = 0; i < 5; i++) qDebug() << "QueryPartition " << queries[i].fileName() << ": " << queryPartitions[i]; | ||
| 269 | + for (int i = 0; i < 5; i++) qDebug() << "TargetPartition " << targets[i].fileName() << ": " << targetPartitions[i]; | ||
| 270 | + | ||
| 268 | Mat mask(queries.size(), targets.size(), CV_8UC1); | 271 | Mat mask(queries.size(), targets.size(), CV_8UC1); |
| 269 | for (int i=0; i<queries.size(); i++) { | 272 | for (int i=0; i<queries.size(); i++) { |
| 270 | const QString &fileA = queries[i]; | 273 | const QString &fileA = queries[i]; |
openbr/openbr_plugin.cpp
| @@ -401,6 +401,7 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) | @@ -401,6 +401,7 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) | ||
| 401 | { | 401 | { |
| 402 | TemplateList templates; | 402 | TemplateList templates; |
| 403 | foreach (const br::File &file, gallery.split()) { | 403 | foreach (const br::File &file, gallery.split()) { |
| 404 | + qDebug() << file.name; | ||
| 404 | QScopedPointer<Gallery> i(Gallery::make(file)); | 405 | QScopedPointer<Gallery> i(Gallery::make(file)); |
| 405 | TemplateList newTemplates = i->read(); | 406 | TemplateList newTemplates = i->read(); |
| 406 | 407 | ||
| @@ -424,7 +425,6 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) | @@ -424,7 +425,6 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) | ||
| 424 | const int crossValidate = gallery.get<int>("crossValidate"); | 425 | const int crossValidate = gallery.get<int>("crossValidate"); |
| 425 | if (crossValidate > 0) srand(0); | 426 | if (crossValidate > 0) srand(0); |
| 426 | 427 | ||
| 427 | - // Propogate metadata | ||
| 428 | for (int i=newTemplates.size()-1; i>=0; i--) { | 428 | for (int i=newTemplates.size()-1; i>=0; i--) { |
| 429 | newTemplates[i].file.append(gallery.localMetadata()); | 429 | newTemplates[i].file.append(gallery.localMetadata()); |
| 430 | newTemplates[i].file.append(file.localMetadata()); | 430 | newTemplates[i].file.append(file.localMetadata()); |
openbr/openbr_plugin.h
| @@ -299,7 +299,7 @@ struct BR_EXPORT FileList : public QList<File> | @@ -299,7 +299,7 @@ struct BR_EXPORT FileList : public QList<File> | ||
| 299 | * \brief A list of matrices associated with a file. | 299 | * \brief A list of matrices associated with a file. |
| 300 | * | 300 | * |
| 301 | * The br::Template is one of the workhorse classes in OpenBR. | 301 | * The br::Template is one of the workhorse classes in OpenBR. |
| 302 | - * A template represents a biometric at various stages of enrollment and can be modified br::Transform and compared to other templates with br::Distance. | 302 | + * A template represents a biometric at various stages of enrollment and can be modified by br::Transform and compared to other templates with br::Distance. |
| 303 | * | 303 | * |
| 304 | * While there exist many cases (ex. video enrollment, multiple face detects, per-patch subspace learning, ...) where the template will contain more than one matrix, | 304 | * While there exist many cases (ex. video enrollment, multiple face detects, per-patch subspace learning, ...) where the template will contain more than one matrix, |
| 305 | * in most cases templates have exactly one matrix in their list representing a single image at various stages of enrollment. | 305 | * in most cases templates have exactly one matrix in their list representing a single image at various stages of enrollment. |
openbr/plugins/distance.cpp
| @@ -197,7 +197,10 @@ class AverageDistance : public Distance | @@ -197,7 +197,10 @@ class AverageDistance : public Distance | ||
| 197 | if (a.size() != b.size()) qFatal("Comparison size mismatch"); | 197 | if (a.size() != b.size()) qFatal("Comparison size mismatch"); |
| 198 | 198 | ||
| 199 | float score = 0; | 199 | float score = 0; |
| 200 | - for (int i = 0; i < a.size(); i++) score += distance->compare(a[i],b[i]); | 200 | + for (int i = 0; i < a.size(); i++) { |
| 201 | + qDebug() << "Computing score for: " << a.file.name << " vs. " << b.file.name; | ||
| 202 | + score += distance->compare(a[i],b[i]); | ||
| 203 | + } | ||
| 201 | 204 | ||
| 202 | return score/(float)a.size(); | 205 | return score/(float)a.size(); |
| 203 | } | 206 | } |
openbr/plugins/misc.cpp
| @@ -307,7 +307,7 @@ BR_REGISTER(Transform, LabelTransform) | @@ -307,7 +307,7 @@ BR_REGISTER(Transform, LabelTransform) | ||
| 307 | 307 | ||
| 308 | /*! | 308 | /*! |
| 309 | * \ingroup transforms | 309 | * \ingroup transforms |
| 310 | - * \brief Name a point | 310 | + * \brief Remove a name from a point |
| 311 | * \author Scott Klum \cite sklum | 311 | * \author Scott Klum \cite sklum |
| 312 | */ | 312 | */ |
| 313 | class AnonymizeTransform : public UntrainableMetaTransform | 313 | class AnonymizeTransform : public UntrainableMetaTransform |
openbr/plugins/stasm.cpp
| @@ -33,15 +33,13 @@ BR_REGISTER(Initializer, StasmInitializer) | @@ -33,15 +33,13 @@ BR_REGISTER(Initializer, StasmInitializer) | ||
| 33 | * \brief Wraps STASM key point detector | 33 | * \brief Wraps STASM key point detector |
| 34 | * \author Scott Klum \cite sklum | 34 | * \author Scott Klum \cite sklum |
| 35 | */ | 35 | */ |
| 36 | -// TODO: Use a global mutex to prevent concurrent calls to AsmSearchDll | ||
| 37 | - | ||
| 38 | class StasmTransform : public UntrainableTransform | 36 | class StasmTransform : public UntrainableTransform |
| 39 | { | 37 | { |
| 40 | Q_OBJECT | 38 | Q_OBJECT |
| 41 | 39 | ||
| 42 | void init() | 40 | void init() |
| 43 | { | 41 | { |
| 44 | - Globals->setProperty("parallelism", "0"); // Can only work in single threaded mode | 42 | + // Load models |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | void project(const Template &src, Template &dst) const | 45 | void project(const Template &src, Template &dst) const |
| @@ -49,22 +47,22 @@ class StasmTransform : public UntrainableTransform | @@ -49,22 +47,22 @@ class StasmTransform : public UntrainableTransform | ||
| 49 | static QMutex mutex; | 47 | static QMutex mutex; |
| 50 | QMutexLocker locker(&mutex); | 48 | QMutexLocker locker(&mutex); |
| 51 | 49 | ||
| 52 | - int nlandmarks; | 50 | + int numLandmarks; |
| 53 | int landmarks[500]; | 51 | int landmarks[500]; |
| 54 | 52 | ||
| 55 | - AsmSearchDll(&nlandmarks, landmarks, | ||
| 56 | - qPrintable(src.file.name), reinterpret_cast<char*>(src.m().data), src.m().cols, src.m().rows, | ||
| 57 | - src.m(), (src.m().channels() == 3), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/")); | 53 | + AsmSearchDll(numLandmarks, landmarks, qPrintable(src.file.name), reinterpret_cast<char*>(src.m().data), src.m(), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/")); |
| 58 | 54 | ||
| 59 | - if (nlandmarks == 0) { | 55 | + if (numLandmarks == 0) { |
| 60 | qWarning("Unable to detect Stasm landmarks for %s", qPrintable(src.file.fileName())); | 56 | qWarning("Unable to detect Stasm landmarks for %s", qPrintable(src.file.fileName())); |
| 61 | dst.file.set("FTE", true); | 57 | dst.file.set("FTE", true); |
| 62 | dst.m() = src.m(); | 58 | dst.m() = src.m(); |
| 63 | return; | 59 | return; |
| 64 | } | 60 | } |
| 65 | 61 | ||
| 66 | - for (int i = 0; i < nlandmarks; i++) | 62 | + for (int i = 0; i < numLandmarks; i++) { |
| 63 | + qDebug() << QPointF(landmarks[2 * i], landmarks[2 * i + 1]); | ||
| 67 | dst.file.appendPoint(QPointF(landmarks[2 * i], landmarks[2 * i + 1])); | 64 | dst.file.appendPoint(QPointF(landmarks[2 * i], landmarks[2 * i + 1])); |
| 65 | + } | ||
| 68 | 66 | ||
| 69 | dst.m() = src.m(); | 67 | dst.m() = src.m(); |
| 70 | } | 68 | } |