SemSegNovelty.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. //! low level Segmentation method
  39. RegionSegmentationMethod *regionSeg;
  40. //! set of forbidden/background classes
  41. std::set<int> forbidden_classes;
  42. std::set<int> forbidden_classesTrain;
  43. std::set<int> classesInUse;
  44. //! obviously, the number of classes used for training
  45. int numberOfClasses;
  46. //! where to save the uncertainty
  47. std::string uncertdir;
  48. public:
  49. /** constructor
  50. * @param conf needs a configfile
  51. * @param md and a MultiDataset (contains images and other things)
  52. */
  53. SemSegNovelty ( const NICE::Config *conf, const MultiDataset *md );
  54. /** simple destructor */
  55. virtual ~SemSegNovelty();
  56. /** The trainingstep
  57. * @param md and a MultiDataset (contains images and other things)
  58. */
  59. void train ( const MultiDataset *md );
  60. /** The main procedure. Input: Image, Output: Segmented Image with pixelwise labeles and the probabilities
  61. * @param ce image data
  62. * @param segresult result of the semantic segmentation with a label for each pixel
  63. * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
  64. */
  65. void semanticseg ( CachedExample *ce,
  66. NICE::Image & segresult,
  67. NICE::MultiChannelImageT<double> & probabilities );
  68. };
  69. } //namespace
  70. #endif