Przeglądaj źródła

added GenericFPClassifierSelection for FeaturePoolClassifiers

Alexander Freytag 11 lat temu
rodzic
commit
292a31add2
1 zmienionych plików z 71 dodań i 0 usunięć
  1. 71 0
      classifier/GenericFPClassifierSelection.h

+ 71 - 0
classifier/GenericFPClassifierSelection.h

@@ -0,0 +1,71 @@
+#ifndef _NICE_OBJREC_GENERICFPCLASSIFIERSELECTION_INCLUDE
+#define _NICE_OBJREC_GENERICFPCLASSIFIERSELECTION_INCLUDE
+
+//STL
+#include <vector>
+
+//core
+#include "core/basics/StringTools.h"
+
+//vislearning -- feature pool classifier
+#include "vislearning/classifier/fpclassifier/boosting/FPCBoosting.h"
+#include "vislearning/classifier/fpclassifier/randomforest/FPCRandomForests.h"
+#include "vislearning/classifier/fpclassifier/randomforest/FPCDecisionTree.h"
+#include "vislearning/classifier/fpclassifier/logisticregression/FPCSMLR.h"
+#include "vislearning/classifier/fpclassifier/FPCGPHIK.h"
+
+
+
+
+
+
+
+
+namespace OBJREC {
+
+  class GenericFPClassifierSelection
+  {
+    public:
+
+      static FeaturePoolClassifier *selectFPClassifier ( const NICE::Config *conf, std::string classifier_type )
+      {
+        std::vector<std::string> submatches;
+        OBJREC::FeaturePoolClassifier *classifier = NULL;
+
+        ////////////////////////////////////////
+        //                                    //
+        //    all Feature Pool Classifiers    //
+        //                                    //
+        ////////////////////////////////////////
+        if ( classifier_type == "GPHIK" )
+        {
+          classifier = new OBJREC::FPCGPHIK ( conf, "GPHIK" );
+        }      
+        else if ( classifier_type == "random_forest" ) {
+          classifier = new OBJREC::FPCRandomForests ( conf, "RandomForest" );
+        }
+        else if ( classifier_type == "sparse_logistic_regression" )
+        {
+          classifier = new OBJREC::FPCSMLR ( conf, "SparseLogisticRegression" );
+        }
+        else if ( classifier_type == "boost" )
+        {
+          classifier = new OBJREC::FPCBoosting ( conf, "Boost" );
+        }
+        else if ( classifier_type == "decision_tree" )
+        {
+          classifier = new OBJREC::FPCDecisionTree ( conf, "DecisionTree" );
+        } else
+        {
+          fthrow ( NICE::Exception, "Classifier type " << classifier_type << " not (yet) supported." << std::endl <<
+                  "(genericFPClassifierSelection.h contains a list of classifiers to choose from)" );
+        }
+
+        return classifier;
+      }
+
+  };
+
+}
+
+#endif