From 4fab7f69ddc82d6ba40a73fc6233e3cc9871473e Mon Sep 17 00:00:00 2001 From: Jordan Cheney Date: Wed, 13 May 2015 11:22:05 -0400 Subject: [PATCH] Revert to old classification method to avoid regression --- openbr/plugins/classification/boostedforest.cpp | 6 +++--- openbr/plugins/classification/cascade.cpp | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/openbr/plugins/classification/boostedforest.cpp b/openbr/plugins/classification/boostedforest.cpp index 015570e..0ac1a93 100644 --- a/openbr/plugins/classification/boostedforest.cpp +++ b/openbr/plugins/classification/boostedforest.cpp @@ -118,7 +118,7 @@ class BoostedForestClassifier : public Classifier featureEvaluator.setImage(images[i], labels[i], i); CascadeBoost boost; - boost.train(&featureEvaluator, images.size(), 1024, 1024, params); + boost.train(&featureEvaluator, images.size(), 2048, 2048, params); // Convert into simpler, cleaner cascade after training threshold = boost.getThreshold(); @@ -151,8 +151,8 @@ class BoostedForestClassifier : public Classifier } if (sum < threshold) - return -std::abs(sum); - return std::abs(sum); + return 0.0f; //-std::abs(sum); + return 1.0f; //std::abs(sum); } int numFeatures() const diff --git a/openbr/plugins/classification/cascade.cpp b/openbr/plugins/classification/cascade.cpp index 43a34bd..951ba0e 100644 --- a/openbr/plugins/classification/cascade.cpp +++ b/openbr/plugins/classification/cascade.cpp @@ -157,7 +157,12 @@ class CascadeClassifier : public Classifier float classify(const Mat &image) const { - if (stages.size() == 0) // special case for empty cascade + foreach (const Classifier *stage, stages) + if (stage->classify(image) == 0) + return 0.0f; + return 1.0f; + + /*if (stages.size() == 0) // special case for empty cascade return 1.0f; float result = 0.0f; @@ -167,7 +172,7 @@ class CascadeClassifier : public Classifier if (result < 0) return stageIdx > (stages.size() - 4) ? stageIdx * result : 0.0f; } - return std::abs(stages.size() * result); + return std::abs(stages.size() * result);*/ } int numFeatures() const -- libgit2 0.21.4