SemSegNovelty.h 2.5 KB

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