/** * @file RelativeLocationPrior.h * @brief a post procession step after semantic segmentation which use relative location priors * @author Björn Fröhlich * @date 06/10/2009 */ #ifndef RELATIVELOCATIONPRIORINCLUDE #define RELATIVELOCATIONPRIORINCLUDE #include "core/image/MultiChannelImageT.h" #include "vislearning/cbaselib/CachedExample.h" #include "vislearning/baselib/Preprocess.h" #include "vislearning/baselib/Globals.h" #include "vislearning/classifier/fpclassifier/logisticregression/SLR.h" #include "vislearning/classifier/fpclassifier/randomforest/FPCRandomForests.h" #include "vislearning/features/fpfeatures/SparseVectorFeature.h" #include "vislearning/cbaselib/ClassNames.h" namespace OBJREC { class RelativeLocationPrior : public NICE::Persistent { protected: //! the priormaps std::vector *> priormaps; //! the configfile const NICE::Config *conf; //! count of classes int classno; //! size of the priormaps (mapsize x mapsize) int mapsize; //! convert Image coordinates to priormaps coordinates void convertCoords ( int &x, int xsize ); //! the trainingsdata will be added subsequently to this object Examples trainingsdata; //! the one vs all sparse logistic classifiers std::vector classifiers; //! dimension of the features int featdim; public: /** simple constructor */ RelativeLocationPrior(); /** simple constructor */ RelativeLocationPrior ( const NICE::Config *_conf ); /** simple destructor */ ~RelativeLocationPrior(); /** * set the count of classes * @param _classno count of classes */ void setClassNo ( int _classno ); /** initialize the RelativeLocationPrior Variables*/ void Init(); /** * Bestimme aus dem Trainingsbild, die location priors maps * @param regions input regions with size, position and label */ void trainPriorsMaps ( Examples ®ions, int xsize, int ysize ); /** * finish the priors maps */ void finishPriorsMaps ( ClassNames &cn ); /** * Bestimme aus dem Trainingsbild, die location priors maps * @param regions input regions with size and position * @param probabilities the probabiltiy maps */ void trainClassifier ( Examples ®ions, NICE::MultiChannelImageT & probabilities ); /** * finish the classfiers */ void finishClassifier(); /** * appends the featurevector to the given example * @param regions input regions with size and position * @param probabilities the probabiltiy maps */ void getFeature ( Examples ®ions, NICE::MultiChannelImageT & probabilities ); /** * uses the rlp for reclassification * @param regions * @param result * @param probabilities */ void postprocess ( Examples ®ions, NICE::MultiChannelImageT & probabilities ); /** * load data from an input stream * @param is input stream * @param format */ void restore ( std::istream & is, int format = 0 ); /** * write data to an output stream * @param os outputstream * @param format */ void store ( std::ostream & os, int format = 0 ) const; /** * clear all informations */ void clear (); }; } //namespace #endif