VCDTSVM.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * @file VCDTSVM.h
  3. * @brief Interface to DTSVM
  4. * @author Björn Fröhlich
  5. * @date 08-02-2011
  6. */
  7. #ifndef VCDTSVMINCLUDE
  8. #define VCDTSVMINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "vislearning/cbaselib/LabeledSet.h"
  12. #include "vislearning/classifier/classifierbase/VecClassifier.h"
  13. namespace OBJREC {
  14. class VCDTSVM : public VecClassifier
  15. {
  16. protected:
  17. NICE::Vector max;
  18. NICE::Vector min;
  19. int normalization_type;
  20. /** where to find the binary file */
  21. std::string binary;
  22. /** where to find the DT-SVM config files */
  23. std::string configtrain;
  24. std::string configtest;
  25. std::string trainfile;
  26. std::string testfile;
  27. private:
  28. std::vector<std::vector<double> > results;
  29. std::vector<int> *counter;
  30. //int counter;
  31. std::vector<int> labels;
  32. public:
  33. /** using a config file to read some settings */
  34. VCDTSVM ( const NICE::Config *conf, const std::string & section = "VCDTSVM" );
  35. /** simple copy constructor */
  36. VCDTSVM ( const VCDTSVM & src );
  37. /** simple destructor */
  38. virtual ~VCDTSVM();
  39. /** classify using simple vector */
  40. ClassificationResult classify ( const NICE::Vector & x ) const;
  41. /** classify using a simple vector */
  42. void teach ( const LabeledSetVector & teachSet );
  43. void finishTeaching();
  44. /** clone this object */
  45. virtual VCDTSVM *clone ( void ) const;
  46. void clear ();
  47. void read ( const std::string& s, int format = 0 );
  48. void save ( const std::string& s, int format = 0 ) const;
  49. void store ( std::ostream & os, int format = 0 ) const;
  50. void restore ( std::istream & is, int format = 0 );
  51. };
  52. } // namespace
  53. #endif