XMM - Probabilistic Models for Motion Recognition and Mapping

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
xmm::GMM Class Reference

Gaussian Mixture Model for Continuous Recognition and Regression (Multi-class) More...

#include <xmmGmm.hpp>

Inheritance diagram for xmm::GMM:
[legend]
Collaboration diagram for xmm::GMM:
[legend]

Public Member Functions

 GMM (bool bimodal=false)
 Constructor. More...
 
 GMM (GMM const &src)
 Copy Constructor. More...
 
 GMM (Json::Value const &root)
 Constructor from Json Structure. More...
 
GMMoperator= (GMM const &src)
 Assignment. More...
 
Performance
virtual void reset ()
 Resets the fitering process (recognition or regression) More...
 
virtual void filter (std::vector< float > const &observation)
 filters a incoming observation (performs recognition or regression) More...
 
Class Manipulation
unsigned int size () const
 Get the number of classes in the model. More...
 
bool hasClass (std::string const &label) const
 Checks if a class exists. More...
 
int getIndex (std::string const &label) const
 Checks if a class exists. More...
 
virtual void removeClass (std::string const &label)
 Remove a specific class by label. More...
 
virtual void clear ()
 Remove all classes. More...
 
Training
bool trained () const
 Checks if the model is trained (training finished and not empty) More...
 
bool training () const
 Checks if the model is still training. More...
 
virtual void train (TrainingSet *trainingSet)
 Train all classes from the training set passed in argument. More...
 
virtual void train (TrainingSet *trainingSet, std::string const &label)
 Train a specific class from the training set passed in argument. More...
 
void cancelTraining ()
 Cancels the training of all models. More...
 
void cancelTraining (std::string const &label)
 Cancels the training of a given class. More...
 
Json I/O
virtual Json::Value toJson () const
 Write the object to a JSON Structure. More...
 
void fromJson (Json::Value const &root)
 Read the object from a JSON Structure. More...
 
Python File I/O
void writeFile (char *fileName) const
 write method for python wrapping ('write' keyword forbidden, name has to be different) More...
 
void readFile (char *fileName)
 read method for python wrapping ('read' keyword forbidden, name has to be different) More...
 
std::string __str__ () const
 "print" method for python => returns the results of write method More...
 

Public Attributes

Results< GMMresults
 Convert to bimodal GMM in place. More...
 
std::shared_ptr< SharedParametersshared_parameters
 Set of Parameters shared among classes. More...
 
Configuration< GMMconfiguration
 Configuration (default and class-specific parameters) More...
 
EventGenerator< TrainingEventtraining_events
 Generator for training process events. More...
 
std::map< std::string, SingleClassGMMmodels
 models stored in a map. Each Model is associated with a label More...
 

Protected Member Functions

virtual void updateResults ()
 Update the results (Likelihoods) More...
 
virtual void joinTraining ()
 Finishes the background training process by joining threads and deleting the models which training failed. More...
 
void onTrainingEvent (TrainingEvent const &e)
 Monitors the training of each Model of the group. More...
 
void checkTraining () const
 Checks if the Model is still training. More...
 
void checkConfigurationChanges () const
 Look for configuration changes and throws an exception if the model is not up to date. More...
 
virtual void addModelForClass (std::string const &label)
 Update training set for a specific label. More...
 

Protected Attributes

std::map< std::string, std::thread > training_threads_
 Training Threads. More...
 
std::atomic< bool > cancel_required_
 locks the Model while the models are training Used in cancel method More...
 
std::atomic< bool > is_training_
 locks the Model while the models are training Used in cancel method More...
 
std::atomic< bool > is_joining_
 specifies if a thread for joining the training process has been launched. More...
 
unsigned int models_still_training_
 Number of models that are still training. More...
 
std::mutex event_mutex_
 Mutex that prevents concurrent calls to onEvent() More...
 

Detailed Description

Gaussian Mixture Model for Continuous Recognition and Regression (Multi-class)

Constructor & Destructor Documentation

xmm::GMM::GMM ( bool  bimodal = false)

Constructor.

Parameters
bimodalspecifies if the model should be used for regression
xmm::GMM::GMM ( GMM const &  src)

Copy Constructor.

Parameters
srcSource Model
xmm::GMM::GMM ( Json::Value const &  root)
explicit

Constructor from Json Structure.

Parameters
rootJson Value

Member Function Documentation

std::string xmm::Writable::__str__ ( ) const
inlineinherited

"print" method for python => returns the results of write method

Warning
only defined if SWIGPYTHON is defined
virtual void xmm::Model< SingleClassGMM , GMM >::addModelForClass ( std::string const &  label)
inlineprotectedvirtualinherited

Update training set for a specific label.

Parameters
labellabel of the sub-training set to update
Exceptions
out_of_rangeif the label does not exist
void xmm::Model< SingleClassGMM , GMM >::cancelTraining ( )
inlineinherited

Cancels the training of all models.

void xmm::Model< SingleClassGMM , GMM >::cancelTraining ( std::string const &  label)
inlineinherited

Cancels the training of a given class.

Parameters
labellabel of the class to cancel
void xmm::Model< SingleClassGMM , GMM >::checkConfigurationChanges ( ) const
inlineprotectedinherited

Look for configuration changes and throws an exception if the model is not up to date.

void xmm::Model< SingleClassGMM , GMM >::checkTraining ( ) const
inlineprotectedinherited

Checks if the Model is still training.

Exceptions
runtime_errorif the Model is training.
virtual void xmm::Model< SingleClassGMM , GMM >::clear ( )
inlinevirtualinherited

Remove all classes.

void xmm::GMM::filter ( std::vector< float > const &  observation)
virtual

filters a incoming observation (performs recognition or regression)

the results of the inference process are stored in the results attribute

Parameters
observationobservation vector

Reimplemented from xmm::Model< SingleClassGMM, GMM >.

void xmm::Model< SingleClassGMM , GMM >::fromJson ( Json::Value const &  root)
inlinevirtualinherited

Read the object from a JSON Structure.

Parameters
rootJSON value containing the object's information
Exceptions
JsonExceptionif the JSON value has a wrong format

Implements xmm::Writable.

int xmm::Model< SingleClassGMM , GMM >::getIndex ( std::string const &  label) const
inlineinherited

Checks if a class exists.

Parameters
labelclass label
Returns
true if the class labeled 'label' exists
bool xmm::Model< SingleClassGMM , GMM >::hasClass ( std::string const &  label) const
inlineinherited

Checks if a class exists.

Parameters
labelclass label
Returns
true if the class labeled 'label' exists
virtual void xmm::Model< SingleClassGMM , GMM >::joinTraining ( )
inlineprotectedvirtualinherited

Finishes the background training process by joining threads and deleting the models which training failed.

void xmm::Model< SingleClassGMM , GMM >::onTrainingEvent ( TrainingEvent const &  e)
inlineprotectedinherited

Monitors the training of each Model of the group.

xmm::GMM & xmm::GMM::operator= ( GMM const &  src)

Assignment.

Parameters
srcSource Model
void xmm::Writable::readFile ( char *  fileName)
inlineinherited

read method for python wrapping ('read' keyword forbidden, name has to be different)

Warning
only defined if SWIGPYTHON is defined
virtual void xmm::Model< SingleClassGMM , GMM >::removeClass ( std::string const &  label)
inlinevirtualinherited

Remove a specific class by label.

Parameters
labellabel of the class to remove
void xmm::GMM::reset ( )
virtual

Resets the fitering process (recognition or regression)

Reimplemented from xmm::Model< SingleClassGMM, GMM >.

unsigned int xmm::Model< SingleClassGMM , GMM >::size ( ) const
inlineinherited

Get the number of classes in the model.

Returns
the number of classes in the model
virtual Json::Value xmm::Model< SingleClassGMM , GMM >::toJson ( ) const
inlinevirtualinherited

Write the object to a JSON Structure.

Returns
Json value containing the object's information

Implements xmm::Writable.

virtual void xmm::Model< SingleClassGMM , GMM >::train ( TrainingSet trainingSet)
inlinevirtualinherited

Train all classes from the training set passed in argument.

Parameters
trainingSetTraining Set
virtual void xmm::Model< SingleClassGMM , GMM >::train ( TrainingSet trainingSet,
std::string const &  label 
)
inlinevirtualinherited

Train a specific class from the training set passed in argument.

Parameters
trainingSetTraining Set
labellabel of the class to train
Exceptions
out_of_rangeif the label does not exist
runtime_errorif the dimensions of the training set don't match the dimensions of the current model
bool xmm::Model< SingleClassGMM , GMM >::trained ( ) const
inlineinherited

Checks if the model is trained (training finished and not empty)

bool xmm::Model< SingleClassGMM , GMM >::training ( ) const
inlineinherited

Checks if the model is still training.

void xmm::GMM::updateResults ( )
protectedvirtual

Update the results (Likelihoods)

void xmm::Writable::writeFile ( char *  fileName) const
inlineinherited

write method for python wrapping ('write' keyword forbidden, name has to be different)

Warning
only defined if SWIGPYTHON is defined

Member Data Documentation

std::atomic<bool> xmm::Model< SingleClassGMM , GMM >::cancel_required_
protectedinherited

locks the Model while the models are training Used in cancel method

Configuration<GMM > xmm::Model< SingleClassGMM , GMM >::configuration
inherited

Configuration (default and class-specific parameters)

std::mutex xmm::Model< SingleClassGMM , GMM >::event_mutex_
protectedinherited

Mutex that prevents concurrent calls to onEvent()

std::atomic<bool> xmm::Model< SingleClassGMM , GMM >::is_joining_
protectedinherited

specifies if a thread for joining the training process has been launched.

std::atomic<bool> xmm::Model< SingleClassGMM , GMM >::is_training_
protectedinherited

locks the Model while the models are training Used in cancel method

std::map<std::string, SingleClassGMM > xmm::Model< SingleClassGMM , GMM >::models
inherited

models stored in a map. Each Model is associated with a label

unsigned int xmm::Model< SingleClassGMM , GMM >::models_still_training_
protectedinherited

Number of models that are still training.

Results<GMM> xmm::GMM::results

Convert to bimodal GMM in place.

Parameters
dimension_inputdimension of the input modality
Exceptions
runtime_errorif the model is already bimodal
out_of_rangeif the requested input dimension is too large Convert to unimodal GMM in place
runtime_errorif the model is already unimodal extract a submodel with the given columns
Parameters
columnscolumns indices in the target order
Exceptions
runtime_errorif the model is training
out_of_rangeif the number or indices of the requested columns exceeds the current dimension
Returns
a GMM from the current model considering only the target columns extract the submodel of the input modality
Exceptions
runtime_errorif the model is training or if it is not bimodal
Returns
a unimodal GMM of the input modality from the current bimodal model extract the submodel of the output modality
Exceptions
runtime_errorif the model is training or if it is not bimodal
Returns
a unimodal GMM of the output modality from the current bimodal model extract the model with reversed input and output modalities
Exceptions
runtime_errorif the model is training or if it is not bimodal
Returns
a bimodal GMM that swaps the input and output modalities Results of the Filtering Process (Recognition + Regression)
std::shared_ptr<SharedParameters> xmm::Model< SingleClassGMM , GMM >::shared_parameters
inherited

Set of Parameters shared among classes.

EventGenerator<TrainingEvent> xmm::Model< SingleClassGMM , GMM >::training_events
inherited

Generator for training process events.

std::map<std::string, std::thread> xmm::Model< SingleClassGMM , GMM >::training_threads_
protectedinherited

Training Threads.


The documentation for this class was generated from the following files: