#include <GMMParameterEstimator.h>
Public Member Functions | |
void | addDatum (Eigen::Vector3d pSample) |
void | addDatum (Eigen::Quaternion< double > pSample) |
void | getModel (GaussianMixtureModel &gmm) |
GMMParameterEstimator (unsigned int pNumberOfDimensions, unsigned int pNumberOfKernelsMin, unsigned int pNumberOfKernelsMax, unsigned int pNumberOfRuns, unsigned int pNumberOfSyntheticSamples, double pIntervalPosition, double pIntervalOrientation, std::string pPathOrientationPlots, unsigned int pAttemptsPerKernel) | |
void | learn () |
void | plotModel () |
~GMMParameterEstimator () | |
Private Member Functions | |
bool | runExpectationMaximization (const std::vector< std::vector< double >> data, unsigned int nc, unsigned int &nparams, double &llk, double &bic, GaussianMixtureModel &model, bool useGenericMatrices=true) |
Private Attributes | |
unsigned int | mAttemptsPerRun |
GaussianMixtureModel | mBestGMM |
std::vector< std::vector< double > > | mData |
double | mIntervalOrientation |
double | mIntervalPosition |
unsigned int | mNumberDimensions |
unsigned int | mNumberKernels |
unsigned int | mNumberKernelsMax |
unsigned int | mNumberKernelsMin |
unsigned int | mNumberOfRuns |
unsigned int | mNumberOfSyntheticSamples |
std::string | mPathOrientationPlots |
This is a learner for gaussian mixture models (GMMs). It uses an EM algorithm to learn the mixture distribution. A maximumum likelihood process is used, so different numbers of kernels up to a maximal number are tried. The GMM with the highest likelihood is taken.
The implementation is taken from the probt documentation and can be found in the following subdirectory: /doc/html/d1/d22/a00057.html'
Definition at line 57 of file GMMParameterEstimator.h.
ProbabilisticSceneRecognition::GMMParameterEstimator::GMMParameterEstimator | ( | unsigned int | pNumberOfDimensions, |
unsigned int | pNumberOfKernelsMin, | ||
unsigned int | pNumberOfKernelsMax, | ||
unsigned int | pNumberOfRuns, | ||
unsigned int | pNumberOfSyntheticSamples, | ||
double | pIntervalPosition, | ||
double | pIntervalOrientation, | ||
std::string | pPathOrientationPlots, | ||
unsigned int | pAttemptsPerKernel | ||
) |
Constructor.
pNumberOfDimensions | The number of dimensions of the learning samples. |
pNumberOfKernelsMin | The minimal number of kernels to try during GMM learning. |
pNumberOfKernelsMax | The maximal number of kernels to try during GMM learning. |
pNumberOfRuns | The number of runs per kernel. |
pNumberOfSyntheticSamples | The number of synthetic voised samples to gereate from a given seed sample. |
pIntervalPosition | The position interval for the sample relaxiation. |
pIntervalOrientation | The orientation interval for the sample relaxiation. |
pPathOrientationPlots | Path to the orientation plots. |
pAttemptsPerKernel | Attempts to find a valid kernel until learner gives up. |
Definition at line 22 of file GMMParameterEstimator.cpp.
ProbabilisticSceneRecognition::GMMParameterEstimator::~GMMParameterEstimator | ( | ) |
Destructor.
Definition at line 36 of file GMMParameterEstimator.cpp.
void ProbabilisticSceneRecognition::GMMParameterEstimator::addDatum | ( | Eigen::Vector3d | pSample | ) |
Adds a single datum to the learner.
pSample | A single sample. |
Definition at line 40 of file GMMParameterEstimator.cpp.
void ProbabilisticSceneRecognition::GMMParameterEstimator::addDatum | ( | Eigen::Quaternion< double > | pSample | ) |
Adds a single datum to the learner.
pSample | A single sample. |
Definition at line 74 of file GMMParameterEstimator.cpp.
void ProbabilisticSceneRecognition::GMMParameterEstimator::getModel | ( | GaussianMixtureModel & | gmm | ) |
Copies the gaussian mixture model into the given container.
gmm | The container to copy the gaussian mixture model into. |
Definition at line 208 of file GMMParameterEstimator.cpp.
void ProbabilisticSceneRecognition::GMMParameterEstimator::learn | ( | ) |
Learns a gaussian mixture model from the given data.
Definition at line 121 of file GMMParameterEstimator.cpp.
void ProbabilisticSceneRecognition::GMMParameterEstimator::plotModel | ( | ) |
Plots the model using ProBT.
Definition at line 214 of file GMMParameterEstimator.cpp.
|
private |
Runs the EM algorithm for a given number of kernels. Uses OpenCV.
data | working data. |
nc | Number of kernels to do the EM algorithm for. |
nparams | Number of parameters as determined by the EM algorithm. |
llk | Log likelihood of the model evaluated under the learning data. |
bic | Bayesian Information Criterion score of the model evaluated under the learning data. |
model | Gaussian mixture model in form of a joind distribution. |
useGenericMatrices | Whether to use generic matrices as covariance matrices (true) or more stable but less precise diagonal matrices. |
Definition at line 287 of file GMMParameterEstimator.cpp.
|
private |
Number of attempts to find a valid kernel until learner gives up.
Definition at line 168 of file GMMParameterEstimator.h.
|
private |
The learned GMM with the best BIC score from OpenCV.
Definition at line 178 of file GMMParameterEstimator.h.
|
private |
The data to learn from.
Definition at line 173 of file GMMParameterEstimator.h.
|
private |
Definition at line 158 of file GMMParameterEstimator.h.
|
private |
The intervals (position and orientation) for the sample relaxiation.
Definition at line 158 of file GMMParameterEstimator.h.
|
private |
The number of dimensions of the learning samples.
Definition at line 137 of file GMMParameterEstimator.h.
|
private |
Definition at line 143 of file GMMParameterEstimator.h.
|
private |
Definition at line 143 of file GMMParameterEstimator.h.
|
private |
The minimal, maximal and the full number of kernels. We do EM learning of GMMs for kernels [min,max] and take the GMM with the highest likelihood.
Definition at line 143 of file GMMParameterEstimator.h.
|
private |
The number of runs per kernel, used for picking the best model.
Definition at line 148 of file GMMParameterEstimator.h.
|
private |
For every sample, n noised samples are generated to make orientation and position learning more tolerant.
Definition at line 153 of file GMMParameterEstimator.h.
|
private |
Path to the orientation plots.
Definition at line 163 of file GMMParameterEstimator.h.