SemSegConvolutionalTree.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**
  2. * @file SemSegConvolutionalTree.h
  3. * @brief Semantic Segmentation using Covolutional Trees
  4. * @author Sven Sickert
  5. * @date 10/17/2014
  6. */
  7. #ifndef SEMSEGCONVOLUTIONALTREEINCLUDE
  8. #define SEMSEGCONVOLUTIONALTREEINCLUDE
  9. // nice-core includes
  10. // nice-vislearning includes
  11. #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
  12. // nice-semseg includes
  13. #include "SemanticSegmentation.h"
  14. namespace OBJREC
  15. {
  16. class SemSegConvolutionalTree : public SemanticSegmentation
  17. {
  18. private:
  19. /** pointer to config file */
  20. const NICE::Config *conf;
  21. /** save / load trained classifier */
  22. bool saveLoadData;
  23. /** file location of trained classifier */
  24. std::string fileLocation;
  25. /** classifier for categorization */
  26. FeaturePoolClassifier *fpc;
  27. void convertRGBToHSV ( CachedExample *ce ) const;
  28. public:
  29. /** simple constructor */
  30. SemSegConvolutionalTree ();
  31. /** config constructor */
  32. SemSegConvolutionalTree ( const NICE::Config *conf,
  33. const ClassNames *classNames );
  34. /** simple destructor */
  35. virtual ~SemSegConvolutionalTree();
  36. /**
  37. * @brief Setup internal variables and objects used
  38. * @param conf Configuration file to specify variable settings
  39. * @param s_confSection Section in configuration file
  40. */
  41. void initFromConfig (
  42. const NICE::Config *_conf,
  43. const std::string & s_confSection = "SemSegConvolutionalTree" );
  44. /**
  45. * @brief training function / learn classifier
  46. * @param md the data set
  47. */
  48. void train ( const MultiDataset *md );
  49. /**
  50. * @brief classification function
  51. @param ce image data
  52. @param segresult result of the semantic segmentation with a label
  53. for each pixel
  54. @param probabilities multi-channel image with one channel for
  55. each class and corresponding probabilities for each pixel
  56. */
  57. void semanticseg ( CachedExample *ce,
  58. NICE::Image &segresult,
  59. NICE::MultiChannelImageT<double> &probabilities );
  60. ///////////////////// INTERFACE PERSISTENT /////////////////////
  61. // interface specific methods for store and restore
  62. ///////////////////// INTERFACE PERSISTENT /////////////////////
  63. /**
  64. * @brief Load segmentation object from external file (stream)
  65. */
  66. virtual void restore ( std::istream & is, int format = 0 );
  67. /**
  68. * @brief Save segmentation-object to external file (stream)
  69. */
  70. virtual void store( std::ostream & os, int format = 0 ) const;
  71. /**
  72. * @brief Clear segmentation-object object
  73. */
  74. virtual void clear ();
  75. };
  76. } // namespace
  77. #endif