VCDTSVM.h 1.6 KB

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