| 1 |
/** @file gmm.h |
| 2 |
** @brief GMM (@ref gmm) |
| 3 |
** @author David Novotny |
| 4 |
** @author Andrea Vedaldi |
| 5 |
**/ |
| 6 |
|
| 7 |
/* |
| 8 |
Copyright (C) 2013 David Novotny and Andrea Vedaldi. |
| 9 |
All rights reserved. |
| 10 |
|
| 11 |
This file is part of the VLFeat library and is made available under |
| 12 |
the terms of the BSD license (see the COPYING file). |
| 13 |
*/ |
| 14 |
|
| 15 |
#ifndef VL_GMM_H |
| 16 |
#define VL_GMM_H |
| 17 |
|
| 18 |
#include "kmeans.h" |
| 19 |
|
| 20 |
/** @brief GMM initialization algorithms */ |
| 21 |
typedef enum _VlGMMInitialization |
| 22 |
{ |
| 23 |
VlGMMKMeans, /**< Initialize GMM from KMeans clustering. */ |
| 24 |
VlGMMRand, /**< Initialize GMM parameters by selecting points at random. */ |
| 25 |
VlGMMCustom /**< User specifies the initial GMM parameters. */ |
| 26 |
} VlGMMInitialization ; |
| 27 |
|
| 28 |
|
| 29 |
#ifndef __DOXYGEN__ |
| 30 |
struct _VlGMM ; |
| 31 |
typedef struct _VlGMM VlGMM ; |
| 32 |
#else |
| 33 |
/** @brief GMM quantizer */ |
| 34 |
typedef OPAQUE VlGMM ; |
| 35 |
#endif |
| 36 |
|
| 37 |
/** @name Create and destroy |
| 38 |
** @{ |
| 39 |
**/ |
| 40 |
VL_EXPORT VlGMM * vl_gmm_new (vl_type dataType, vl_size dimension, vl_size numComponents) ; |
| 41 |
VL_EXPORT VlGMM * vl_gmm_new_copy (VlGMM const * gmm) ; |
| 42 |
VL_EXPORT void vl_gmm_delete (VlGMM * self) ; |
| 43 |
VL_EXPORT void vl_gmm_reset (VlGMM * self); |
| 44 |
/** @} */ |
| 45 |
|
| 46 |
/** @name Basic data processing |
| 47 |
** @{ |
| 48 |
**/ |
| 49 |
VL_EXPORT double |
| 50 |
vl_gmm_cluster |
| 51 |
(VlGMM * self, |
| 52 |
void const * data, |
| 53 |
vl_size numData); |
| 54 |
/** @} */ |
| 55 |
|
| 56 |
/** @name Fine grained data processing |
| 57 |
** @{ */ |
| 58 |
|
| 59 |
VL_EXPORT void |
| 60 |
vl_gmm_init_with_rand_data |
| 61 |
(VlGMM * self, |
| 62 |
void const * data, |
| 63 |
vl_size numData) ; |
| 64 |
|
| 65 |
VL_EXPORT void |
| 66 |
vl_gmm_init_with_kmeans |
| 67 |
(VlGMM * self, |
| 68 |
void const * data, |
| 69 |
vl_size numData, |
| 70 |
VlKMeans * kmeansInit); |
| 71 |
|
| 72 |
VL_EXPORT double |
| 73 |
vl_gmm_em |
| 74 |
(VlGMM * self, |
| 75 |
void const * data, |
| 76 |
vl_size numData); |
| 77 |
/** @} */ |
| 78 |
|
| 79 |
VL_EXPORT void |
| 80 |
vl_gmm_set_means |
| 81 |
(VlGMM * self, |
| 82 |
void const * means); |
| 83 |
|
| 84 |
VL_EXPORT void |
| 85 |
vl_gmm_set_covariances |
| 86 |
(VlGMM * self, |
| 87 |
void const * covariances); |
| 88 |
|
| 89 |
VL_EXPORT void |
| 90 |
vl_gmm_set_priors |
| 91 |
(VlGMM * self, |
| 92 |
void const * priors); |
| 93 |
|
| 94 |
VL_EXPORT double |
| 95 |
vl_get_gmm_data_posteriors_f(float * posteriors, |
| 96 |
vl_size numClusters, |
| 97 |
vl_size numData, |
| 98 |
float const * priors, |
| 99 |
float const * means, |
| 100 |
vl_size dimension, |
| 101 |
float const * covariances, |
| 102 |
float const * data) ; |
| 103 |
|
| 104 |
VL_EXPORT double |
| 105 |
vl_get_gmm_data_posteriors_d(double * posteriors, |
| 106 |
vl_size numClusters, |
| 107 |
vl_size numData, |
| 108 |
double const * priors, |
| 109 |
double const * means, |
| 110 |
vl_size dimension, |
| 111 |
double const * covariances, |
| 112 |
double const * data) ; |
| 113 |
/** @} */ |
| 114 |
|
| 115 |
/** @name Set parameters |
| 116 |
** @{ |
| 117 |
**/ |
| 118 |
VL_EXPORT void vl_gmm_set_num_repetitions (VlGMM * self, vl_size numRepetitions) ; |
| 119 |
VL_EXPORT void vl_gmm_set_max_num_iterations (VlGMM * self, vl_size maxNumIterations) ; |
| 120 |
VL_EXPORT void vl_gmm_set_verbosity (VlGMM * self, int verbosity) ; |
| 121 |
VL_EXPORT void vl_gmm_set_initialization (VlGMM * self, VlGMMInitialization init); |
| 122 |
VL_EXPORT void vl_gmm_set_kmeans_init_object (VlGMM * self, VlKMeans * kmeans); |
| 123 |
VL_EXPORT void vl_gmm_set_covariance_lower_bounds (VlGMM * self, double const * bounds); |
| 124 |
VL_EXPORT void vl_gmm_set_covariance_lower_bound (VlGMM * self, double bound) ; |
| 125 |
/** @} */ |
| 126 |
|
| 127 |
/** @name Get parameters |
| 128 |
** @{ |
| 129 |
**/ |
| 130 |
VL_EXPORT void const * vl_gmm_get_means (VlGMM const * self); |
| 131 |
VL_EXPORT void const * vl_gmm_get_covariances (VlGMM const * self); |
| 132 |
VL_EXPORT void const * vl_gmm_get_priors (VlGMM const * self); |
| 133 |
VL_EXPORT void const * vl_gmm_get_posteriors (VlGMM const * self); |
| 134 |
VL_EXPORT vl_type vl_gmm_get_data_type (VlGMM const * self); |
| 135 |
VL_EXPORT vl_size vl_gmm_get_dimension (VlGMM const * self); |
| 136 |
VL_EXPORT vl_size vl_gmm_get_num_repetitions (VlGMM const * self); |
| 137 |
VL_EXPORT vl_size vl_gmm_get_num_data (VlGMM const * self); |
| 138 |
VL_EXPORT vl_size vl_gmm_get_num_clusters (VlGMM const * self); |
| 139 |
VL_EXPORT double vl_gmm_get_loglikelihood (VlGMM const * self); |
| 140 |
VL_EXPORT int vl_gmm_get_verbosity (VlGMM const * self); |
| 141 |
VL_EXPORT vl_size vl_gmm_get_max_num_iterations (VlGMM const * self); |
| 142 |
VL_EXPORT vl_size vl_gmm_get_num_repetitions (VlGMM const * self); |
| 143 |
VL_EXPORT VlGMMInitialization vl_gmm_get_initialization (VlGMM const * self); |
| 144 |
VL_EXPORT VlKMeans * vl_gmm_get_kmeans_init_object (VlGMM const * self); |
| 145 |
VL_EXPORT double const * vl_gmm_get_covariance_lower_bounds (VlGMM const * self); |
| 146 |
/** @} */ |
| 147 |
|
| 148 |
/* VL_GMM_H */ |
| 149 |
#endif |