GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
GRT::FeatureExtraction Class Reference
Inheritance diagram for GRT::FeatureExtraction:
GRT::MLBase GRT::GRTBase GRT::Observer< TrainingResult > GRT::Observer< TestInstanceResult > GRT::FFT GRT::FFTFeatures GRT::KMeansFeatures GRT::KMeansQuantizer GRT::MovementIndex GRT::MovementTrajectoryFeatures GRT::RBMQuantizer GRT::RegisterFeatureExtractionModule< T > GRT::SOMQuantizer GRT::TimeDomainFeatures GRT::TimeseriesBuffer GRT::ZeroCrossingCounter GRT::RegisterFeatureExtractionModule< GRT::FFT > GRT::RegisterFeatureExtractionModule< GRT::FFTFeatures > GRT::RegisterFeatureExtractionModule< GRT::KMeansFeatures > GRT::RegisterFeatureExtractionModule< GRT::KMeansQuantizer > GRT::RegisterFeatureExtractionModule< GRT::MovementIndex > GRT::RegisterFeatureExtractionModule< GRT::MovementTrajectoryFeatures > GRT::RegisterFeatureExtractionModule< GRT::RBMQuantizer > GRT::RegisterFeatureExtractionModule< GRT::SOMQuantizer > GRT::RegisterFeatureExtractionModule< GRT::TimeDomainFeatures > GRT::RegisterFeatureExtractionModule< GRT::TimeseriesBuffer > GRT::RegisterFeatureExtractionModule< GRT::ZeroCrossingCounter >

Public Types

typedef std::map< string, FeatureExtraction *(*)() > StringFeatureExtractionMap
 
- Public Types inherited from GRT::MLBase
enum  BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER }
 

Public Member Functions

 FeatureExtraction ()
 
virtual ~FeatureExtraction ()
 
virtual bool deepCopyFrom (const FeatureExtraction *rhs)
 
bool copyBaseVariables (const FeatureExtraction *featureExtractionModule)
 
virtual bool computeFeatures (const VectorDouble &inputVector)
 
virtual bool reset ()
 
virtual bool clear ()
 
virtual bool saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (fstream &file)
 
string getFeatureExtractionType () const
 
UINT getNumInputDimensions () const
 
UINT getNumOutputDimensions () const
 
bool getInitialized () const
 
bool getFeatureDataReady () const
 
VectorDouble getFeatureVector () const
 
FeatureExtractioncreateNewInstance () const
 
- Public Member Functions inherited from GRT::MLBase
 MLBase (void)
 
virtual ~MLBase (void)
 
bool copyMLBaseVariables (const MLBase *mlBase)
 
virtual bool train (ClassificationData trainingData)
 
virtual bool train_ (ClassificationData &trainingData)
 
virtual bool train (RegressionData trainingData)
 
virtual bool train_ (RegressionData &trainingData)
 
virtual bool train (TimeSeriesClassificationData trainingData)
 
virtual bool train_ (TimeSeriesClassificationData &trainingData)
 
virtual bool train (TimeSeriesClassificationDataStream trainingData)
 
virtual bool train_ (TimeSeriesClassificationDataStream &trainingData)
 
virtual bool train (UnlabelledData trainingData)
 
virtual bool train_ (UnlabelledData &trainingData)
 
virtual bool train (MatrixDouble data)
 
virtual bool train_ (MatrixDouble &data)
 
virtual bool predict (VectorDouble inputVector)
 
virtual bool predict_ (VectorDouble &inputVector)
 
virtual bool predict (MatrixDouble inputMatrix)
 
virtual bool predict_ (MatrixDouble &inputMatrix)
 
virtual bool map (VectorDouble inputVector)
 
virtual bool map_ (VectorDouble &inputVector)
 
virtual bool print () const
 
virtual bool save (const string filename) const
 
virtual bool load (const string filename)
 
virtual bool saveModelToFile (string filename) const
 
virtual bool loadModelFromFile (string filename)
 
virtual bool getModel (ostream &stream) const
 
double scale (const double &x, const double &minSource, const double &maxSource, const double &minTarget, const double &maxTarget, const bool constrain=false)
 
virtual string getModelAsString () const
 
UINT getBaseType () const
 
UINT getNumInputFeatures () const
 
UINT getNumInputDimensions () const
 
UINT getNumOutputDimensions () const
 
UINT getMinNumEpochs () const
 
UINT getMaxNumEpochs () const
 
UINT getValidationSetSize () const
 
UINT getNumTrainingIterationsToConverge () const
 
double getMinChange () const
 
double getLearningRate () const
 
double getRootMeanSquaredTrainingError () const
 
double getTotalSquaredTrainingError () const
 
bool getUseValidationSet () const
 
bool getRandomiseTrainingOrder () const
 
bool getTrained () const
 
bool getModelTrained () const
 
bool getScalingEnabled () const
 
bool getIsBaseTypeClassifier () const
 
bool getIsBaseTypeRegressifier () const
 
bool getIsBaseTypeClusterer () const
 
bool enableScaling (bool useScaling)
 
bool setMaxNumEpochs (const UINT maxNumEpochs)
 
bool setMinNumEpochs (const UINT minNumEpochs)
 
bool setMinChange (const double minChange)
 
bool setLearningRate (double learningRate)
 
bool setUseValidationSet (const bool useValidationSet)
 
bool setValidationSetSize (const UINT validationSetSize)
 
bool setRandomiseTrainingOrder (const bool randomiseTrainingOrder)
 
bool registerTrainingResultsObserver (Observer< TrainingResult > &observer)
 
bool registerTestResultsObserver (Observer< TestInstanceResult > &observer)
 
bool removeTrainingResultsObserver (const Observer< TrainingResult > &observer)
 
bool removeTestResultsObserver (const Observer< TestInstanceResult > &observer)
 
bool removeAllTrainingObservers ()
 
bool removeAllTestObservers ()
 
bool notifyTrainingResultsObservers (const TrainingResult &data)
 
bool notifyTestResultsObservers (const TestInstanceResult &data)
 
MLBasegetMLBasePointer ()
 
const MLBasegetMLBasePointer () const
 
vector< TrainingResultgetTrainingResults () const
 
- Public Member Functions inherited from GRT::GRTBase
 GRTBase (void)
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
string getClassType () const
 
string getLastWarningMessage () const
 
string getLastErrorMessage () const
 
string getLastInfoMessage () const
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 
- Public Member Functions inherited from GRT::Observer< TrainingResult >
virtual void notify (const TrainingResult &data)
 
- Public Member Functions inherited from GRT::Observer< TestInstanceResult >
virtual void notify (const TestInstanceResult &data)
 

Static Public Member Functions

static FeatureExtractioncreateInstanceFromString (string const &featureExtractionType)
 
- Static Public Member Functions inherited from GRT::GRTBase
static string getGRTVersion (bool returnRevision=true)
 
static string getGRTRevison ()
 

Protected Member Functions

bool init ()
 
bool saveFeatureExtractionSettingsToFile (fstream &file) const
 
bool loadFeatureExtractionSettingsFromFile (fstream &file)
 
- Protected Member Functions inherited from GRT::MLBase
bool saveBaseSettingsToFile (fstream &file) const
 
bool loadBaseSettingsFromFile (fstream &file)
 
- Protected Member Functions inherited from GRT::GRTBase
double SQR (const double &x) const
 

Static Protected Member Functions

static StringFeatureExtractionMapgetMap ()
 

Protected Attributes

string featureExtractionType
 
bool initialized
 
bool featureDataReady
 
VectorDouble featureVector
 
- Protected Attributes inherited from GRT::MLBase
bool trained
 
bool useScaling
 
UINT baseType
 
UINT numInputDimensions
 
UINT numOutputDimensions
 
UINT numTrainingIterationsToConverge
 
UINT minNumEpochs
 
UINT maxNumEpochs
 
UINT validationSetSize
 
double learningRate
 
double minChange
 
double rootMeanSquaredTrainingError
 
double totalSquaredTrainingError
 
bool useValidationSet
 
bool randomiseTrainingOrder
 
Random random
 
vector< TrainingResulttrainingResults
 
TrainingResultsObserverManager trainingResultsObserverManager
 
TestResultsObserverManager testResultsObserverManager
 
- Protected Attributes inherited from GRT::GRTBase
string classType
 
DebugLog debugLog
 
ErrorLog errorLog
 
InfoLog infoLog
 
TrainingLog trainingLog
 
TestingLog testingLog
 
WarningLog warningLog
 

Detailed Description

Definition at line 38 of file FeatureExtraction.h.

Member Typedef Documentation

Defines a map between a string (which will contain the name of the featureExtraction module, such as FFT) and a function returns a new instance of that featureExtraction

Definition at line 154 of file FeatureExtraction.h.

Constructor & Destructor Documentation

GRT::FeatureExtraction::FeatureExtraction ( )

Default FeatureExtraction Constructor

Definition at line 41 of file FeatureExtraction.cpp.

GRT::FeatureExtraction::~FeatureExtraction ( )
virtual

Default FeatureExtraction Destructor

Definition at line 53 of file FeatureExtraction.cpp.

Member Function Documentation

bool GRT::FeatureExtraction::clear ( )
virtual

This function clears any previous setup.

Returns
returns true if the module was cleared, false otherwise

Reimplemented from GRT::MLBase.

Reimplemented in GRT::FFT, GRT::RBMQuantizer, GRT::KMeansQuantizer, and GRT::SOMQuantizer.

Definition at line 104 of file FeatureExtraction.cpp.

virtual bool GRT::FeatureExtraction::computeFeatures ( const VectorDouble &  inputVector)
inlinevirtual

This function is called by the GestureRecognitionPipeline when any new input data needs to be processed (during the prediction phase for example). This function should be overwritten by the derived class.

Parameters
constVectorDouble &inputVector: the inputVector that should be processed
Returns
returns true if the data was processed, false otherwise (the base class always returns false)

Reimplemented in GRT::FFT, GRT::ZeroCrossingCounter, GRT::RBMQuantizer, GRT::KMeansQuantizer, GRT::SOMQuantizer, GRT::MovementTrajectoryFeatures, GRT::FFTFeatures, GRT::KMeansFeatures, GRT::MovementIndex, GRT::TimeseriesBuffer, and GRT::TimeDomainFeatures.

Definition at line 74 of file FeatureExtraction.h.

bool GRT::FeatureExtraction::copyBaseVariables ( const FeatureExtraction featureExtractionModule)

This copies the FeatureExtraction variables from featureExtractionModule to the instance that calls the function.

Parameters
constFeatureExtraction *featureExtractionModule: a pointer to a feature extraction module from which the values will be copied
Returns
returns true if the copy was successfull, false otherwise

Definition at line 60 of file FeatureExtraction.cpp.

FeatureExtraction * GRT::FeatureExtraction::createNewInstance ( ) const

Creates a new feature extraction instance based on the current featureExtractionType string value.

Returns
FeatureExtraction*: a pointer to the new instance of the feature extraction

Definition at line 37 of file FeatureExtraction.cpp.

virtual bool GRT::FeatureExtraction::deepCopyFrom ( const FeatureExtraction rhs)
inlinevirtual

This is the base deepCopyFrom function for the FeatureExtraction modules. This function should be overwritten by the derived class.

Parameters
constFeatureExtraction *featureExtraction: a pointer to the FeatureExtraction base class, this should be pointing to another instance of a matching derived class
Returns
returns true if the deep copy was successfull, false otherwise (the FeatureExtraction base class will always return flase)

Reimplemented in GRT::FFT, GRT::ZeroCrossingCounter, GRT::KMeansQuantizer, GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::FFTFeatures, GRT::MovementTrajectoryFeatures, GRT::KMeansFeatures, GRT::MovementIndex, GRT::TimeseriesBuffer, and GRT::TimeDomainFeatures.

Definition at line 57 of file FeatureExtraction.h.

bool GRT::FeatureExtraction::getFeatureDataReady ( ) const

Returns true if the feature extraction module has just processed the last input vector and a new output feature vector is ready.

Returns
returns true if the feature extraction module has just processed the last input vector and a new output feature vector is ready, false otherwise

Definition at line 177 of file FeatureExtraction.cpp.

string GRT::FeatureExtraction::getFeatureExtractionType ( ) const

Returns the feature extraction type as a string.

Returns
returns the feature extraction type as a string

Definition at line 161 of file FeatureExtraction.cpp.

VectorDouble GRT::FeatureExtraction::getFeatureVector ( ) const

Returns the current feature vector.

Returns
returns the current feature vector, this vector will be empty if the module has not been initialized

Definition at line 181 of file FeatureExtraction.cpp.

bool GRT::FeatureExtraction::getInitialized ( ) const

Returns true if the feature extraction module has been initialized correctly.

Returns
returns true if the feature extraction module has been initialized succesfully, false otherwise

Definition at line 173 of file FeatureExtraction.cpp.

UINT GRT::FeatureExtraction::getNumInputDimensions ( ) const

Returns the size of the input vector expected by the feature extraction module.

Returns
returns the size of the input vector expected by the feature extraction module

Definition at line 165 of file FeatureExtraction.cpp.

UINT GRT::FeatureExtraction::getNumOutputDimensions ( ) const

Returns the size of the feature vector that will be computed by the feature extraction module.

Returns
returns the size of the feature vector that will be computed by the feature extraction module

Definition at line 169 of file FeatureExtraction.cpp.

bool GRT::FeatureExtraction::init ( )
protected

Initializes the base feature extraction module, this will resize the feature vector and get the instance ready for processing new data.

Returns
returns true if the module was initialized, false otherwise

Definition at line 84 of file FeatureExtraction.cpp.

bool GRT::FeatureExtraction::loadFeatureExtractionSettingsFromFile ( fstream &  file)
protected

Loads the core base settings from a file.

Returns
returns true if the base settings were loaded, false otherwise

Definition at line 130 of file FeatureExtraction.cpp.

virtual bool GRT::FeatureExtraction::loadModelFromFile ( fstream &  file)
inlinevirtual

This loads the feature extraction settings from a file. This function should be overwritten by the derived class.

Parameters
fstream&file: a reference to the file to load the settings from
Returns
returns true if the settings were loaded successfully, false otherwise (the base class always returns false)

Reimplemented from GRT::MLBase.

Reimplemented in GRT::FFT, GRT::RBMQuantizer, GRT::ZeroCrossingCounter, GRT::SOMQuantizer, GRT::MovementTrajectoryFeatures, GRT::FFTFeatures, GRT::KMeansFeatures, GRT::MovementIndex, GRT::KMeansQuantizer, GRT::TimeseriesBuffer, and GRT::TimeDomainFeatures.

Definition at line 107 of file FeatureExtraction.h.

virtual bool GRT::FeatureExtraction::reset ( )
inlinevirtual

This function is called by the GestureRecognitionPipeline's reset function. This function should be overwritten by the derived class.

Returns
returns true if the module was reset, false otherwise (the base class always returns true)

Reimplemented from GRT::MLBase.

Reimplemented in GRT::FFT, GRT::ZeroCrossingCounter, GRT::RBMQuantizer, GRT::KMeansQuantizer, GRT::SOMQuantizer, GRT::MovementTrajectoryFeatures, GRT::FFTFeatures, GRT::KMeansFeatures, GRT::MovementIndex, GRT::TimeseriesBuffer, and GRT::TimeDomainFeatures.

Definition at line 82 of file FeatureExtraction.h.

bool GRT::FeatureExtraction::saveFeatureExtractionSettingsToFile ( fstream &  file) const
protected

Saves the core base settings to a file.

Returns
returns true if the base settings were saved, false otherwise

Definition at line 116 of file FeatureExtraction.cpp.

virtual bool GRT::FeatureExtraction::saveModelToFile ( fstream &  file) const
inlinevirtual

This saves the feature extraction settings to a file. This function should be overwritten by the derived class.

Parameters
fstream&file: a reference to the file to save the settings to
Returns
returns true if the settings were saved successfully, false otherwise (the base class always returns false)

Reimplemented from GRT::MLBase.

Reimplemented in GRT::FFT, GRT::RBMQuantizer, GRT::ZeroCrossingCounter, GRT::SOMQuantizer, GRT::MovementTrajectoryFeatures, GRT::FFTFeatures, GRT::KMeansFeatures, GRT::MovementIndex, GRT::KMeansQuantizer, GRT::TimeseriesBuffer, and GRT::TimeDomainFeatures.

Definition at line 98 of file FeatureExtraction.h.


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