/** * @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 #include "core/image/MultiChannelImageT.h" #include "objrec/cbaselib/CachedExample.h" #include "objrec/baselib/Preprocess.h" #include "objrec/baselib/Globals.h" #include "objrec/classifier/fpclassifier/logisticregression/SLR.h" #include "objrec/classifier/fpclassifier/randomforest/FPCRandomForests.h" #include "objrec/features/fpfeatures/SparseVectorFeature.h" #include "objrec/cbaselib/ClassNames.h" namespace OBJREC { class RelativeLocationPrior : public Persistent { protected: //! the priormaps vector *> priormaps; //! the configfile const 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 vector classifiers; //! dimension of the features int featdim; public: /** simple constructor */ RelativeLocationPrior(); /** simple constructor */ RelativeLocationPrior(const 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 (istream & is, int format = 0); /** * write data to an output stream * @param os outputstream * @param format */ void store (ostream & os, int format = 0) const; /** * clear all informations */ void clear (); }; } //namespace #endif