|
@@ -33,131 +33,16 @@
|
|
|
#include "vislearning/features/simplefeatures/BoWFeatureConverter.h"
|
|
|
//
|
|
|
// vislearning -- local features
|
|
|
-// #include <vislearning/features/localfeatures/LFonHSG.h>
|
|
|
-// #include <vislearning/features/localfeatures/LFColorSande.h>
|
|
|
-// #include <vislearning/features/localfeatures/LFColorWeijer.h>
|
|
|
-// #include <vislearning/features/localfeatures/LFReadCache.h>
|
|
|
-// #include <vislearning/features/localfeatures/LFWriteCache.h>
|
|
|
#include <vislearning/features/localfeatures/GenericLFSelection.h>
|
|
|
//
|
|
|
// vislearning -- clustering methods
|
|
|
#include <vislearning/math/cluster/GenericClusterAlgorithmSelection.h>
|
|
|
-// #include <vislearning/math/cluster/ClusterAlgorithm.h>
|
|
|
-// #include <vislearning/math/cluster/RandomClustering.h>
|
|
|
-// #include <vislearning/math/cluster/KMeans.h>
|
|
|
-// #include <vislearning/math/cluster/KMedian.h>
|
|
|
-// #include <vislearning/math/cluster/GMM.h>
|
|
|
//
|
|
|
|
|
|
using namespace std;
|
|
|
using namespace NICE;
|
|
|
using namespace OBJREC;
|
|
|
|
|
|
-
|
|
|
-// LocalFeatureRepresentation * setFeatureExtractor( const Config * _conf )
|
|
|
-// {
|
|
|
-// LocalFeatureRepresentation * featureExtractor;
|
|
|
-//
|
|
|
-// //feature stuff
|
|
|
-// // which OpponentSIFT implementation to use {NICE, VANDESANDE}
|
|
|
-// std::string opSiftImpl;
|
|
|
-// opSiftImpl = _conf->gS ( "Descriptor", "implementation", "VANDESANDE" );
|
|
|
-// // read features?
|
|
|
-// bool readfeat;
|
|
|
-// readfeat = _conf->gB ( "Descriptor", "read", true );
|
|
|
-// // write features?
|
|
|
-// bool writefeat;
|
|
|
-// writefeat = _conf->gB ( "Descriptor", "write", true );
|
|
|
-//
|
|
|
-// // Welche Opponentsift Implementierung soll genutzt werden ?
|
|
|
-// LocalFeatureRepresentation *cSIFT = NULL;
|
|
|
-// LocalFeatureRepresentation *writeFeats = NULL;
|
|
|
-// LocalFeatureRepresentation *readFeats = NULL;
|
|
|
-// featureExtractor = NULL;
|
|
|
-// if ( opSiftImpl == "NICE" )
|
|
|
-// {
|
|
|
-// cSIFT = new OBJREC::LFonHSG ( _conf, "HSG" );
|
|
|
-// }
|
|
|
-// else if ( opSiftImpl == "VANDESANDE" )
|
|
|
-// {
|
|
|
-// cSIFT = new OBJREC::LFColorSande ( _conf, "LFColorSande" );
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-// fthrow ( Exception, "feattype: %s not yet supported" << opSiftImpl );
|
|
|
-// }
|
|
|
-//
|
|
|
-// featureExtractor = cSIFT;
|
|
|
-//
|
|
|
-// if ( writefeat )
|
|
|
-// {
|
|
|
-// // write the features to a file, if there isn't any to read
|
|
|
-// writeFeats = new LFWriteCache ( _conf, cSIFT );
|
|
|
-// featureExtractor = writeFeats;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ( readfeat )
|
|
|
-// {
|
|
|
-// // read the features from a file
|
|
|
-// if ( writefeat )
|
|
|
-// {
|
|
|
-// readFeats = new LFReadCache ( _conf, writeFeats, -1 );
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-// readFeats = new LFReadCache ( _conf, cSIFT, -1 );
|
|
|
-// }
|
|
|
-// featureExtractor = readFeats;
|
|
|
-// }
|
|
|
-//
|
|
|
-// //only set feature stuff to NULL, deletion of the underlying object is done in the destructor
|
|
|
-// if ( cSIFT != NULL )
|
|
|
-// cSIFT = NULL;
|
|
|
-// if ( writeFeats != NULL )
|
|
|
-// writeFeats = NULL;
|
|
|
-// if ( readFeats != NULL )
|
|
|
-// readFeats = NULL ;
|
|
|
-//
|
|
|
-// return featureExtractor;
|
|
|
-// }
|
|
|
-//
|
|
|
-// OBJREC::ClusterAlgorithm * setClusterAlgo( const Config * _conf )
|
|
|
-// {
|
|
|
-// std::string section ( "clusteringStuff" );
|
|
|
-// // define the initial number of clusters our codebook shall contain
|
|
|
-// int noClusters = _conf->gI(section, "noClusters", 10);
|
|
|
-//
|
|
|
-// // define the clustering algorithm to be used
|
|
|
-// std::string clusterAlgoString = _conf->gS(section, "clusterAlgo", "kmeans");
|
|
|
-//
|
|
|
-// OBJREC::ClusterAlgorithm * clusterAlgo;
|
|
|
-//
|
|
|
-// if (clusterAlgoString.compare("kmeans") == 0)
|
|
|
-// {
|
|
|
-// clusterAlgo = new OBJREC::KMeans(noClusters);
|
|
|
-// }
|
|
|
-// else if (clusterAlgoString.compare("kmedian") == 0)
|
|
|
-// {
|
|
|
-// clusterAlgo = new OBJREC::KMedian(noClusters);
|
|
|
-// }
|
|
|
-// else if (clusterAlgoString.compare("GMM") == 0)
|
|
|
-// {
|
|
|
-// clusterAlgo = new OBJREC::GMM( _conf, noClusters );
|
|
|
-// }
|
|
|
-// else if ( clusterAlgoString.compare("RandomClustering") == 0 )
|
|
|
-// {
|
|
|
-// clusterAlgo = new OBJREC::RandomClustering( _conf, section );
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-// std::cerr << "Unknown cluster algorithm selected, use random clustering instead" << std::endl;
|
|
|
-// clusterAlgo = new OBJREC::RandomClustering( _conf, section );
|
|
|
-// }
|
|
|
-//
|
|
|
-// return clusterAlgo;
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
a complete BoW pipeline
|
|
|
|
|
@@ -190,7 +75,6 @@ int main( int argc, char **argv )
|
|
|
std::cerr << "FEATURE EXTRACTION FOR TRAINING IMAGES" << std::endl;
|
|
|
|
|
|
OBJREC::LocalFeatureRepresentation * featureExtractor = OBJREC::GenericLFSelection::selectLocalFeatureRep ( conf, "features", OBJREC::GenericLFSelection::TRAINING );
|
|
|
-// LocalFeatureRepresentation * featureExtractor = setFeatureExtractor( conf );
|
|
|
|
|
|
//collect features in a single data structure
|
|
|
NICE::VVector featuresFromAllTrainingImages;
|
|
@@ -266,7 +150,6 @@ int main( int argc, char **argv )
|
|
|
//**********************************************
|
|
|
|
|
|
std::cerr << "CODEBOOK CREATION" << std::endl;
|
|
|
-// OBJREC::ClusterAlgorithm * clusterAlgo = setClusterAlgo( conf );
|
|
|
|
|
|
OBJREC::ClusterAlgorithm * clusterAlgo = OBJREC::GenericClusterAlgorithmSelection::selectClusterAlgo ( conf );
|
|
|
|