123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /**
- * @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 <core/vector/Distance.h>
- #include <core/vector/VVector.h>
- #include <vislearning/cbaselib/MultiDataset.h>
- //
- #include <vislearning/features/localfeatures/GenericLocalFeatureSelection.h>
- //
- #include <vislearning/math/cluster/ClusterAlgorithm.h>
- 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<double> * 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 extractFeaturesFromTrainingImages( const OBJREC::MultiDataset *_md, NICE::VVector & examplesTraining );
-
- void train ( const OBJREC::MultiDataset *_md );
-
- virtual bool loadInitialCodebook ( );
- virtual bool writeInitialCodebook ( );
-
- 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 evaluateCurrentCodebook ( const std::string & filename , const bool & beforeComputingNewFeatures = true );
-
- };
- } // namespace
- #endif
|