123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- /**
- * @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 <string>
- //
- //core
- #include <core/basics/Config.h>
- #include <core/image/ImageT.h>
- #include <core/vector/VVector.h>
- //
- //vislearning
- #include <vislearning/cbaselib/CachedExample.h>
- 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<int> 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
|