SemSegConvolutionalTree.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. public:
  28. /** simple constructor */
  29. SemSegConvolutionalTree ();
  30. /** config constructor */
  31. SemSegConvolutionalTree ( const NICE::Config *conf,
  32. const ClassNames *classNames );
  33. /** simple destructor */
  34. virtual ~SemSegConvolutionalTree();
  35. /**
  36. * @brief Setup internal variables and objects used
  37. * @param conf Configuration file to specify variable settings
  38. * @param s_confSection Section in configuration file
  39. */
  40. void initFromConfig (
  41. const NICE::Config *_conf,
  42. const std::string & s_confSection = "SemSegConvolutionalTree" );
  43. /**
  44. * @brief training function / learn classifier
  45. * @param md the data set
  46. */
  47. void train ( const MultiDataset *md );
  48. /**
  49. * @brief classification function
  50. @param ce image data
  51. @param segresult result of the semantic segmentation with a label
  52. for each pixel
  53. @param probabilities multi-channel image with one channel for
  54. each class and corresponding probabilities for each pixel
  55. */
  56. void semanticseg ( CachedExample *ce,
  57. NICE::Image &segresult,
  58. NICE::MultiChannelImageT<double> &probabilities );
  59. ///////////////////// INTERFACE PERSISTENT /////////////////////
  60. // interface specific methods for store and restore
  61. ///////////////////// INTERFACE PERSISTENT /////////////////////
  62. /**
  63. * @brief Load segmentation object from external file (stream)
  64. */
  65. virtual void restore ( std::istream & is, int format = 0 );
  66. /**
  67. * @brief Save segmentation-object to external file (stream)
  68. */
  69. virtual void store( std::ostream & os, int format = 0 ) const;
  70. /**
  71. * @brief Clear segmentation-object object
  72. */
  73. virtual void clear ();
  74. };
  75. } // namespace
  76. #endif