VCDTSVM.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "core/image/ImageT.h"
  12. #include "core/imagedisplay/ImageDisplay.h"
  13. #include "vislearning/cbaselib/LabeledSet.h"
  14. #include "vislearning/classifier/classifierbase/VecClassifier.h"
  15. namespace OBJREC {
  16. class VCDTSVM : public VecClassifier
  17. {
  18. protected:
  19. NICE::Vector max;
  20. NICE::Vector min;
  21. int normalization_type;
  22. /** where to find the binary file */
  23. std::string binary;
  24. /** where to find the DT-SVM config files */
  25. std::string configtrain;
  26. std::string configtest;
  27. std::string trainfile;
  28. std::string testfile;
  29. private:
  30. std::vector<std::vector<double> > results;
  31. std::vector<int> *counter;
  32. //int counter;
  33. std::vector<int> labels;
  34. public:
  35. /** using a config file to read some settings */
  36. VCDTSVM ( const NICE::Config *conf, const std::string & section = "VCDTSVM" );
  37. /** simple copy constructor */
  38. VCDTSVM ( const VCDTSVM & src );
  39. /** simple destructor */
  40. virtual ~VCDTSVM();
  41. /** classify using simple vector */
  42. ClassificationResult classify ( const NICE::Vector & x ) const;
  43. /** classify using a simple vector */
  44. void teach ( const LabeledSetVector & teachSet );
  45. void finishTeaching();
  46. /** clone this object */
  47. virtual VCDTSVM *clone ( void ) const;
  48. void clear ();
  49. void read ( const std::string& s, int format = 0 );
  50. void save ( const std::string& s, int format = 0 ) const;
  51. void store ( std::ostream & os, int format = 0 ) const;
  52. void restore ( std::istream & is, int format = 0 );
  53. };
  54. } // namespace
  55. #endif