From d08187c73da493f6eff82ced6a0f0cb417699791 Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Thu, 2 Oct 2014 10:58:43 -0400 Subject: [PATCH] Arg --- openbr/janus.cpp | 19 +++++++++++++++++-- openbr/plugins/landmarks.cpp | 32 ++++++++++++++++++++++++++++++-- openbr/plugins/misc.cpp | 3 --- openbr/plugins/nn.cpp | 6 +++--- openbr/plugins/stream.cpp | 13 +++++++++++++ openbr/plugins/svm.cpp | 5 +++-- 6 files changed, 66 insertions(+), 12 deletions(-) diff --git a/openbr/janus.cpp b/openbr/janus.cpp index cb6dd7c..dc21bd4 100644 --- a/openbr/janus.cpp +++ b/openbr/janus.cpp @@ -1,5 +1,5 @@ -#include "janus.h" -#include "janus_io.h" +#include "iarpa_janus.h" +#include "iarpa_janus_io.h" #include "openbr_plugin.h" using namespace br; @@ -12,6 +12,21 @@ size_t janus_max_template_size() return 33554432; // 32 MB } +janus_error janus_flatten_gallery(const janus_gallery gallery, janus_flat_gallery flat_gallery, size_t *bytes) +{ + +} + +janus_error janus_compare(const janus_flat_gallery target, const size_t target_bytes, const janus_flat_gallery query, const size_t query_bytes, float *similarity_matrix, janus_template_id *target_ids, janus_template_id *query_ids) +{ + +} + +janus_error janus_flatten_template(const janus_template template_, janus_flat_template flat_template, size_t *bytes) +{ + +} + janus_error janus_initialize(const char *sdk_path, const char *model_file) { int argc = 1; diff --git a/openbr/plugins/landmarks.cpp b/openbr/plugins/landmarks.cpp index 6358fbd..059e013 100644 --- a/openbr/plugins/landmarks.cpp +++ b/openbr/plugins/landmarks.cpp @@ -465,7 +465,7 @@ class NormalizePointsTransform : public UntrainableTransform Q_PROPERTY(int index READ get_index WRITE set_index RESET reset_index STORED false) BR_PROPERTY(int, index, 0) -; + void project(const Template &src, Template &dst) const { dst = src; @@ -474,7 +474,9 @@ class NormalizePointsTransform : public UntrainableTransform QPointF normPoint = points.at(index); QList normalizedPoints; - normalizedPoints.append(normPoint); + // We have nose and two eyes and I want a feature vector like: + // (nose.x-right_eye.x,nose.y-right_eye.y),(nose.x-left_eye.x,nose.y-left_eye.y),(0,0) because we're centering on the nose + for (int i=0; i points = dst.file.points(); + QList normalizedPoints; + + for (int i=0; iverbose) @@ -485,7 +483,6 @@ class SaveMatTransform : public UntrainableMetaTransform void project(const Template &src, Template &dst) const { - qDebug() << "saving mat"; dst = src; dst.file.set(propName, QVariant::fromValue(dst.m())); } diff --git a/openbr/plugins/nn.cpp b/openbr/plugins/nn.cpp index ff797ec..5db354b 100644 --- a/openbr/plugins/nn.cpp +++ b/openbr/plugins/nn.cpp @@ -67,10 +67,10 @@ class MLPTransform : public MetaTransform void init() { Mat layers = Mat(neuronsPerLayer.size(), 1, CV_32SC1); - for (int i=0; i stage_variance; @@ -1594,6 +1599,14 @@ public: bool timeVarying() const { return true; } + // Stream acts as a shallow interface to DirectStream, so it's fine to remove ourselves here + Transform *simplify(bool &newTransform) + { + newTransform = false; + + return basis->simplify(newTransform); + } + void project(const Template &src, Template &dst) const { basis->project(src,dst); diff --git a/openbr/plugins/svm.cpp b/openbr/plugins/svm.cpp index c374586..bc2e37a 100644 --- a/openbr/plugins/svm.cpp +++ b/openbr/plugins/svm.cpp @@ -74,7 +74,7 @@ static void trainSVM(SVM &svm, Mat data, Mat lab, int kernel, int type, float C, svm.train_auto(data, lab, Mat(), Mat(), params, 5); } catch (...) { qWarning("Some classes do not contain sufficient examples or are not discriminative enough for accurate SVM classification."); - svm.train(data, lab); + svm.train(data, lab, Mat(), Mat(), params); } } else { params.C = C; @@ -161,7 +161,8 @@ private: dst.m().at(0, 0) = prediction; // positive values ==> first class // negative values ==> second class - prediction = prediction > 0 ? 0 : 1; + if (type != EPS_SVR && type != NU_SVR) + prediction = prediction > 0 ? 0 : 1; } if (type == EPS_SVR || type == NU_SVR) { dst.file.set(outputVariable, prediction); -- libgit2 0.21.4