123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- /**
- * @file SemanticSegmentation.h
- * @brief abstract interface for semantic segmentation algorithms
- * @author Erik Rodner
- * @date 03/19/2009
- */
- #ifndef SEMANTICSEGMENTATIONINCLUDE
- #define SEMANTICSEGMENTATIONINCLUDE
- #include "vislearning/cbaselib/MultiDataset.h"
- #include "vislearning/cbaselib/LocalizationResult.h"
- #include "vislearning/cbaselib/CachedExample.h"
- #include "vislearning/cbaselib/Example.h"
- #define ROADWORKSADD fthrow(NICE::Exception, "addNewExample(const NICE::Vector & newExample, const int & newClassNo): not yet implemented!");
- #define ROADWORKSADDNOVEL fthrow(NICE::Exception, "addNovelExamples(): not yet implemented!");
- #define ROADWORKSGETNOVEL fthrow(NICE::Exception, "getNovelExamples(): not yet implemented!");
- namespace OBJREC
- {
- /** abstract interface for semantic segmentation algorithms */
- class SemanticSegmentation
- {
- protected:
- /** accessible class names and information about
- number of classes etc. */
- const ClassNames *classNames;
- /** enum type for imagetype */
- enum
- {
- IMAGETYPE_RGB = 0,
- IMAGETYPE_GRAY
- };
- /** whether to load images with color information */
- int imagetype;
-
- int iterationCountSuffix;
- public:
- /** simple constructor
- @param conf global settings
- @param classNames this ClassNames object while be stored as a attribute
- */
- SemanticSegmentation ( const NICE::Config *conf,
- const ClassNames *classNames );
- /** simple destructor */
- virtual ~SemanticSegmentation();
- /** this function has to be overloaded by all subclasses
- @param ce image data
- @param segresult result of the semantic segmentation with a label for each
- pixel
- @param probabilities multi-channel image with one channel for each class and
- corresponding probabilities for each pixel
- */
- virtual void semanticseg ( OBJREC::CachedExample *ce,
- NICE::Image & segresult,
- NICE::MultiChannelImageT<double> & probabilities ) = 0;
- /**
- * convert different datatypes
- */
- void convertVVectorToExamples ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
- void convertExamplesToVVector ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
- void convertExamplesToLSet ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
- void convertLSetToExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec, const bool & removeOldDataPointer=false );
- void convertLSetToSparseExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
- /** load img from file call localize(CachedExample *ce) etc. */
- void semanticseg ( const std::string & filename,
- NICE::Image & segresult,
- NICE::MultiChannelImageT<double> & probabilities );
-
- virtual void addNewExample(const NICE::Vector & newExample, const int & newClassNo)
- {
- ROADWORKSADD;
- };
- /**
- * @brief Add those examples, which belong to the most novel region seen so far
- *
- * @return void
- **/
- virtual void addNovelExamples()
- {
- ROADWORKSADDNOVEL;
- };
-
- /**
- * @brief Get a pointer to the examples extracted from the most novel region seen so far
- *
- * @return Examples *
- **/
- virtual const Examples * getNovelExamples() const
- {
- ROADWORKSGETNOVEL;
- };
-
- void setIterationCountSuffix( const int & _iterationCountSuffix) { iterationCountSuffix = _iterationCountSuffix; };
-
-
- };
- } // namespace
- #endif
|