SemSegNovelty.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * @file SemSegNovelty.h
  3. * @brief semantic segmentation using the method from Csurka08
  4. * @author Björn Fröhlich
  5. * @date 04/24/2009
  6. */
  7. #ifndef SemSegNoveltyINCLUDE
  8. #define SemSegNoveltyINCLUDE
  9. #include "SemanticSegmentation.h"
  10. #include "SemSegTools.h"
  11. #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
  12. #include "vislearning/features/localfeatures/LFColorWeijer.h"
  13. /** @brief pixelwise labeling systems */
  14. namespace OBJREC {
  15. class SemSegNovelty : public SemanticSegmentation
  16. {
  17. protected:
  18. //! boolean whether to save the cache or not
  19. bool save_cache;
  20. //! boolean whether to read the cache or not, if read_cache is false, everything will be trained
  21. bool read_cache;
  22. //! The cached Data
  23. std::string cache;
  24. //! Classifier
  25. FeaturePoolClassifier *classifier;
  26. //! feature extraction
  27. LFColorWeijer *featExtract;
  28. //! Configuration File
  29. const NICE::Config *conf;
  30. //! distance between features for training
  31. int featdist;
  32. //! half of the window size for local features
  33. int whs;
  34. //! rectangle size for classification, 1 means pixelwise
  35. int testWSize;
  36. //! name of all classes
  37. ClassNames cn;
  38. //! set of forbidden/background classes
  39. std::set<int> forbidden_classes;
  40. //! where to save the uncertainty
  41. std::string uncertdir;
  42. public:
  43. /** constructor
  44. * @param conf needs a configfile
  45. * @param md and a MultiDataset (contains images and other things)
  46. */
  47. SemSegNovelty ( const NICE::Config *conf, const MultiDataset *md );
  48. /** simple destructor */
  49. virtual ~SemSegNovelty();
  50. /** The trainingstep
  51. * @param md and a MultiDataset (contains images and other things)
  52. */
  53. void train ( const MultiDataset *md );
  54. /** The main procedure. Input: Image, Output: Segmented Image with pixelwise labeles and the probabilities
  55. * @param ce image data
  56. * @param segresult result of the semantic segmentation with a label for each pixel
  57. * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
  58. */
  59. void semanticseg ( CachedExample *ce,
  60. NICE::Image & segresult,
  61. NICE::MultiChannelImageT<double> & probabilities );
  62. };
  63. } //namespace
  64. #endif