123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- /**
- * @file ConvolutionFeature.h
- * @brief convolutional feature
- * @author Sven Sickert
- * @date 10/13/2014
- */
- #ifndef ConvolutionFeatureINCLUDE
- #define ConvolutionFeatureINCLUDE
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- #include "core/basics/Config.h"
- #include "vislearning/cbaselib/Feature.h"
- namespace OBJREC{
- /** convolutional feature */
- class ConvolutionFeature : public Feature
- {
- protected:
- /////////////////////////
- /////////////////////////
- // PROTECTED VARIABLES //
- /////////////////////////
- /////////////////////////
- /** feature parameter */
- int window_size_x;
- int window_size_y;
- int window_size_z;
- int paramsLength;
- int numChannels;
- bool isColor;
- bool useSpatialPriors;
- NICE::Vector *params;
- /**
- * @brief (re)initialize parameter vector
- */
- void initializeParameterVector();
- public:
- ///////////////////// ///////////////////// /////////////////////
- // CONSTRUCTORS / DESTRUCTORS
- ///////////////////// ///////////////////// /////////////////////
- /** simple constructor */
- ConvolutionFeature ( );
- /** alternative constructor */
- ConvolutionFeature ( const int wsize_x,
- const int wsize_y,
- const bool color = false,
- const bool prior = false );
- /** alternative 3d constructor */
- ConvolutionFeature ( const int wsize_x,
- const int wsize_y,
- const int wsize_z,
- const bool color = false,
- const bool prior = false );
- /** default constructor */
- ConvolutionFeature ( const NICE::Config *conf );
- /** copy constructor */
- ConvolutionFeature ( const ConvolutionFeature *convFeat );
- /** simple destructor */
- virtual ~ConvolutionFeature ( );
- ///////////////////// ///////////////////// /////////////////////
- // FEATURE STUFF
- ///////////////////// ///////////////////// /////////////////////
- /**
- * @brief return isColor variable
- * @return isColor
- */
- bool isColorMode () const;
- /**
- * @brief return parameter vector
- * @return parameter vector
- */
- NICE::Vector getParameterVector () const;
- /**
- * @brief return feature vector
- * @param example current example
- * @param returned feature vector
- */
- void getFeatureVector ( const Example *example, NICE::Vector &vec ) const;
- /**
- * @brief return length of parameter vector
- * @return length of vector
- */
- int getParameterLength () const;
- /**
- * @brief set parameter vector
- * @param vec new parameter vector
- */
- void setParameterVector ( const NICE::Vector &vec );
- /**
- * @brief set a random parameter vector
- */
- void setRandomParameterVector ();
- /**
- * @brief return feature value for given example
- * @param example given Example
- * @return double feature value
- */
- double val ( const Example *example ) const;
- /**
- * @brief create feature pool with convolutional features
- * @param featurePool to be filled
- * @param variableWindow
- */
- void explode ( FeaturePool &featurePool, bool variableWindow = true ) const;
- /**
- * @brief clone current feature
- * @return clone of current feature
- */
- Feature *clone () const;
- Feature *generateFirstParameter () const;
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- // interface specific methods for store and restore
- ///////////////////// INTERFACE PERSISTENT /////////////////////
- /**
- * @brief Load convolution feature object from external file (stream)
- */
- void restore ( std::istream & is, int format = 0 );
- /**
- * @brief Save convolution feature object to external file (stream)
- */
- void store( std::ostream & os, int format = 0 ) const;
- /**
- * @brief Clear convolution feature object
- */
- void clear ();
- };
- } //namespace
- #endif
|