12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #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", "");
-
- 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 == "random" )
- {
- 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
|