/** * @file FeatureLearningPrototypes.h * @brief compute new histogram entries somehow, represent clusters only based on representatives, no additional information like dimensionwise variances... * @author Alexander Freytag * @date 17-04-2013 (dd-mm-yyyy) */ #ifndef _INCLUDEFEATURELEARNINGPROTOTYPES #define _INCLUDEFEATURELEARNINGPROTOTYPES #include "FeatureLearningGeneric.h" #include #include #include // #include // #include namespace OBJREC { /** * @class FeatureLearningPrototypes * @brief compute new histogram entries somehow, represent clusters only based on representatives, no additional information like dimensionwise variances... * @author Alexander Freytag * @date 17-04-2013 (dd-mm-yyyy) */ class FeatureLearningPrototypes : public FeatureLearningGeneric { protected: /************************ * * protected variables * **************************/ bool showTrainingImages; //! define the initial number of clusters our codebook shall contain int initialNumberOfClusters; OBJREC::ClusterAlgorithm * clusterAlgo; NICE::VectorDistance * distFunction; LocalFeatureRepresentation * featureExtractor; //! The currently known "cluster" centers, which are used for BoW histogram computation NICE::VVector prototypes; int newImageCounter; //just needed for visualisation double oldMaxDist; //TODO stupid!!! double maxValForVisualization; /************************ * * protected methods * **************************/ void setClusterAlgo( const std::string & _clusterAlgoString); void setFeatureExtractor( const bool & _setForTraining = false); void extractFeaturesFromTrainingImages( const OBJREC::MultiDataset *_md, NICE::VVector & examplesTraining ); void train ( const OBJREC::MultiDataset *_md ); virtual bool loadInitialCodebook ( ); virtual bool writeInitialCodebook ( ); virtual void evaluateCurrentCodebookForGivenFeatures ( const NICE::VVector & _features, const NICE::VVector & _positions, NICE::FloatImage & _noveltyImageGaussFiltered, NICE::FloatImage * _noveltyImage = NULL ); public: /** constructor * @param _conf needs a configfile * @param _md and a MultiDataset (contains images and other things) */ FeatureLearningPrototypes ( const NICE::Config *_conf, const OBJREC::MultiDataset *_md , const std::string & _section = "featureLearning"); /** simple destructor */ virtual ~FeatureLearningPrototypes(); /** this function has to be overloaded by all subclasses @param imgWithNovelContent */ virtual void learnNewFeatures ( const std::string & _filename ) = 0 ; virtual NICE::FloatImage evaluateCurrentCodebookByDistance ( const std::string & _filename , const bool & beforeComputingNewFeatures = true ); virtual NICE::ImageT evaluateCurrentCodebookByAssignments ( const std::string & _filename , const bool & beforeComputingNewFeatures = true, const bool & _binaryShowLatestPrototype = false); }; } // namespace #endif