/** * @file FeatureLearningGeneric.h * @brief abstract interface for feature learning algorithms * @author Alexander Freytag * @date 16-04-2013 (dd-mm-yyyy) */ #ifndef _INCLUDEFEATURELEARNING #define _INCLUDEFEATURELEARNING #define ROADWORKS fthrow(NICE::Exception, "Feature Learning -- not yet implemented!"); //STL #include // //core #include #include #include // //vislearning #include namespace OBJREC { /** * @class FeatureLearningGeneric * @brief abstract interface for feature learning algorithms * @author Alexander Freytag * @date 16-04-2013 (dd-mm-yyyy) */ class FeatureLearningGeneric { protected: /************************ * * protected variables * **************************/ //! section information for parsing config files std::string section; //! Configuration File const NICE::Config *conf; //! where should an initial codebook be located, i.e., read from and written to? std::string cacheInitialCodebook; //! was an initial codebook already computed? bool b_loadInitialCodebook; //!shall the initially computed codebook be stored somewhere? bool b_saveInitialCodebook; //! additional evaluation in the process of feature learning, e.g., visualize the most useful features in the current image bool b_evaluationWhileFeatureLearning; bool b_showTrainingImages; bool b_showResults; std::string s_resultdir; /************************ * * protected methods * **************************/ /** * @brief Load a previously computed codebook which serves as initial codebook * @author Alexander Freytag * @date 17-04-2013 (dd-mm-yyyy) * @return bool (success of loading) * @note This function has to be overloaded by all subclasses! */ virtual bool loadInitialCodebook ( ) = 0; /** * @brief Store the initially computed codebook * @author Alexander Freytag * @date 17-04-2013 (dd-mm-yyyy) * @return bool (success of writing) * @note This function has to be overloaded by all subclasses! */ virtual bool writeInitialCodebook ( ) = 0; public: /** * @brief simple constructor * @author Alexander Freytag * @date 16-04-2013 (dd-mm-yyyy) * @param _conf global settings * @param _section section information for parsing config files */ FeatureLearningGeneric ( const NICE::Config *_conf, const std::string & _section = "featureLearning" ); /** simple destructor */ virtual ~FeatureLearningGeneric(); /** * @brief Learn new features to explain a previously unseen image with novel content * @author Alexander Freytag * @date 16-04-2013 (dd-mm-yyyy) * @param _filename of the new image * @note This function has to be overloaded by all subclasses! */ virtual void learnNewFeatures ( const std::string & _filename) = 0; virtual NICE::FloatImage evaluateCurrentCodebookByDistance ( const std::string & _filename , const bool & beforeComputingNewFeatures = true) = 0; virtual NICE::ImageT evaluateCurrentCodebookByAssignments ( const std::string & _filename , const bool & beforeComputingNewFeatures = true, const bool & _binaryShowLatestPrototype = false) = 0; virtual void evaluateCurrentCodebookByConfusionMatrix( NICE::Matrix & _confusionMat ) = 0; virtual NICE::VVector * getCurrentCodebook() = 0; }; } // namespace #endif