123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- /**
- * @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<NICE::MultiChannelImageT<double> *> 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<SLR> 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<double> & 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<double> & probabilities );
- /**
- * uses the rlp for reclassification
- * @param regions
- * @param result
- * @param probabilities
- */
- void postprocess ( Examples ®ions, NICE::MultiChannelImageT<double> & 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
|