123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef _NICE_GENERICCLUSTERALGORITHMSELECTION_INCLUDE
- #define _NICE_GENERICCLUSTERALGORITHMSELECTION_INCLUDE
- #include <iostream>
- #include "vislearning/math/cluster/ClusterAlgorithm.h"
- #include "vislearning/math/cluster/GMM.h"
- #include "vislearning/math/cluster/KMeans.h"
- #include "vislearning/math/cluster/KMeansHeuristic.h"
- #include "vislearning/math/cluster/KMeansMatlab.h"
- #include "vislearning/math/cluster/KMedian.h"
- #include "vislearning/math/cluster/RandomClustering.h"
- #include "vislearning/math/cluster/SpectralCluster.h"
- namespace OBJREC {
-
- class GenericClusterAlgorithmSelection
- {
- public:
-
- static
- OBJREC::ClusterAlgorithm *selectClusterAlgo ( const NICE::Config *conf, std::string section = "clustering" )
- {
-
- OBJREC::ClusterAlgorithm *clusterAlgo = NULL;
-
-
- std::string clusterTechnique = conf->gS(section, "clusterTechnique", "");
-
- std::cerr << "clusterTechnique: " << clusterTechnique << std::endl;
-
- if ( clusterTechnique == "kmeans" )
- {
- clusterAlgo = new OBJREC::KMeans ( conf );
- }
- else if ( clusterTechnique == "kmeansHeuristic" )
- {
- clusterAlgo = new OBJREC::KMeansHeuristic ( conf );
- }
- else if ( clusterTechnique == "kmeansMatlab" )
- {
- clusterAlgo = new OBJREC::KMeansMatlab ( conf );
- }
- else if ( clusterTechnique == "kmedian" )
- {
- clusterAlgo = new OBJREC::KMedian ( conf );
- }
- else if ( clusterTechnique == "GMM" )
- {
- clusterAlgo = new OBJREC::GMM ( conf );
- }
- else if ( clusterTechnique == "spectral" )
- {
- clusterAlgo = new OBJREC::SpectralCluster ( conf );
- }
- else if ( clusterTechnique == "RandomClustering" )
- {
- clusterAlgo = new OBJREC::RandomClustering ( conf );
- }
- else
- {
-
- std::cerr << "Unknown cluster algorithm selected, use random clustering instead" << std::endl;
- clusterAlgo = new OBJREC::RandomClustering ( conf );
- }
-
- return clusterAlgo;
- }
- };
- }
- #endif
|