GenericFPClassifierSelection.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _NICE_OBJREC_GENERICFPCLASSIFIERSELECTION_INCLUDE
  2. #define _NICE_OBJREC_GENERICFPCLASSIFIERSELECTION_INCLUDE
  3. //STL
  4. #include <vector>
  5. //core
  6. #include "core/basics/StringTools.h"
  7. //vislearning -- feature pool classifier
  8. #include "vislearning/classifier/fpclassifier/boosting/FPCBoosting.h"
  9. #include "vislearning/classifier/fpclassifier/randomforest/FPCRandomForests.h"
  10. #include "vislearning/classifier/fpclassifier/randomforest/FPCDecisionTree.h"
  11. #include "vislearning/classifier/fpclassifier/logisticregression/FPCSMLR.h"
  12. #include "vislearning/classifier/fpclassifier/gphik/FPCGPHIK.h"
  13. namespace OBJREC {
  14. class GenericFPClassifierSelection
  15. {
  16. public:
  17. static FeaturePoolClassifier *selectFPClassifier ( const NICE::Config *conf, std::string classifier_type )
  18. {
  19. std::vector<std::string> submatches;
  20. OBJREC::FeaturePoolClassifier *classifier = NULL;
  21. ////////////////////////////////////////
  22. // //
  23. // all Feature Pool Classifiers //
  24. // //
  25. ////////////////////////////////////////
  26. if ( classifier_type == "GPHIK" )
  27. {
  28. classifier = new OBJREC::FPCGPHIK ( conf, "GPHIK" );
  29. }
  30. else if ( classifier_type == "random_forest" ) {
  31. classifier = new OBJREC::FPCRandomForests ( conf, "RandomForest" );
  32. }
  33. else if ( classifier_type == "sparse_logistic_regression" )
  34. {
  35. classifier = new OBJREC::FPCSMLR ( conf, "SparseLogisticRegression" );
  36. }
  37. else if ( classifier_type == "boost" )
  38. {
  39. classifier = new OBJREC::FPCBoosting ( conf, "Boost" );
  40. }
  41. else if ( classifier_type == "decision_tree" )
  42. {
  43. classifier = new OBJREC::FPCDecisionTree ( conf, "DecisionTree" );
  44. } else
  45. {
  46. fthrow ( NICE::Exception, "Classifier type " << classifier_type << " not (yet) supported." << std::endl <<
  47. "(genericFPClassifierSelection.h contains a list of classifiers to choose from)" );
  48. }
  49. return classifier;
  50. }
  51. };
  52. }
  53. #endif