GestureRecognitionToolkit
Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
|
#include <PostProcessing.h>
Public Types | |
enum | PostprocessingInputModes { INPUT_MODE_NOT_SET =0, INPUT_MODE_PREDICTED_CLASS_LABEL, INPUT_MODE_CLASS_LIKELIHOODS } |
enum | PostprocessingOutputModes { OUTPUT_MODE_NOT_SET =0, OUTPUT_MODE_PREDICTED_CLASS_LABEL, OUTPUT_MODE_CLASS_LIKELIHOODS } |
typedef std::map< std::string, PostProcessing *(*)() > | StringPostProcessingMap |
Public Types inherited from MLBase | |
enum | BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER } |
Public Member Functions | |
PostProcessing (void) | |
virtual | ~PostProcessing (void) |
virtual bool | deepCopyFrom (const PostProcessing *postProcessing) |
bool | copyBaseVariables (const PostProcessing *postProcessingModule) |
virtual bool | process (const VectorFloat &inputVector) |
virtual bool | reset () |
virtual bool | saveModelToFile (std::string filename) const |
virtual bool | loadModelFromFile (std::string filename) |
virtual bool | saveModelToFile (std::fstream &file) const |
virtual bool | loadModelFromFile (std::fstream &file) |
std::string | getPostProcessingType () const |
UINT | getPostProcessingInputMode () const |
UINT | getPostProcessingOutputMode () const |
UINT | getNumInputDimensions () const |
UINT | getNumOutputDimensions () const |
bool | getInitialized () const |
bool | getIsPostProcessingInputModePredictedClassLabel () const |
bool | getIsPostProcessingInputModeClassLikelihoods () const |
bool | getIsPostProcessingOutputModePredictedClassLabel () const |
bool | getIsPostProcessingOutputModeClassLikelihoods () const |
VectorFloat | getProcessedData () const |
PostProcessing * | createNewInstance () const |
Public Member Functions inherited from 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 (ClassificationDataStream trainingData) |
virtual bool | train_ (ClassificationDataStream &trainingData) |
virtual bool | train (UnlabelledData trainingData) |
virtual bool | train_ (UnlabelledData &trainingData) |
virtual bool | train (MatrixFloat data) |
virtual bool | train_ (MatrixFloat &data) |
virtual bool | predict (VectorFloat inputVector) |
virtual bool | predict_ (VectorFloat &inputVector) |
virtual bool | predict (MatrixFloat inputMatrix) |
virtual bool | predict_ (MatrixFloat &inputMatrix) |
virtual bool | map (VectorFloat inputVector) |
virtual bool | map_ (VectorFloat &inputVector) |
virtual bool | clear () |
virtual bool | print () const |
virtual bool | save (const std::string filename) const |
virtual bool | load (const std::string filename) |
virtual bool | getModel (std::ostream &stream) const |
Float | scale (const Float &x, const Float &minSource, const Float &maxSource, const Float &minTarget, const Float &maxTarget, const bool constrain=false) |
virtual std::string | getModelAsString () const |
DataType | getInputType () const |
DataType | getOutputType () 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 |
Float | getMinChange () const |
Float | getLearningRate () const |
Float | getRootMeanSquaredTrainingError () const |
Float | getTotalSquaredTrainingError () const |
Float | getValidationSetAccuracy () const |
VectorFloat | getValidationSetPrecision () const |
VectorFloat | getValidationSetRecall () 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 (const bool useScaling) |
bool | setMaxNumEpochs (const UINT maxNumEpochs) |
bool | setMinNumEpochs (const UINT minNumEpochs) |
bool | setMinChange (const Float minChange) |
bool | setLearningRate (const Float learningRate) |
bool | setUseValidationSet (const bool useValidationSet) |
bool | setValidationSetSize (const UINT validationSetSize) |
bool | setRandomiseTrainingOrder (const bool randomiseTrainingOrder) |
bool | setTrainingLoggingEnabled (const bool loggingEnabled) |
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) |
MLBase * | getMLBasePointer () |
const MLBase * | getMLBasePointer () const |
Vector< TrainingResult > | getTrainingResults () const |
Public Member Functions inherited from GRTBase | |
GRTBase (void) | |
virtual | ~GRTBase (void) |
bool | copyGRTBaseVariables (const GRTBase *GRTBase) |
std::string | getClassType () const |
std::string | getLastWarningMessage () const |
std::string | getLastErrorMessage () const |
std::string | getLastInfoMessage () const |
bool | setInfoLoggingEnabled (const bool loggingEnabled) |
bool | setWarningLoggingEnabled (const bool loggingEnabled) |
bool | setErrorLoggingEnabled (const bool loggingEnabled) |
GRTBase * | getGRTBasePointer () |
const GRTBase * | getGRTBasePointer () const |
Public Member Functions inherited from Observer< TrainingResult > | |
virtual void | notify (const TrainingResult &data) |
Public Member Functions inherited from Observer< TestInstanceResult > | |
virtual void | notify (const TestInstanceResult &data) |
Static Public Member Functions | |
static PostProcessing * | createInstanceFromString (std::string const &postProcessingType) |
Static Public Member Functions inherited from GRTBase | |
static std::string | getGRTVersion (bool returnRevision=true) |
static std::string | getGRTRevison () |
Protected Member Functions | |
bool | init () |
bool | savePostProcessingSettingsToFile (std::fstream &file) const |
bool | loadPostProcessingSettingsFromFile (std::fstream &file) |
Protected Member Functions inherited from MLBase | |
bool | saveBaseSettingsToFile (std::fstream &file) const |
bool | loadBaseSettingsFromFile (std::fstream &file) |
Protected Member Functions inherited from GRTBase | |
Float | SQR (const Float &x) const |
Static Protected Member Functions | |
static StringPostProcessingMap * | getMap () |
Protected Attributes | |
std::string | postProcessingType |
bool | initialized |
UINT | postProcessingInputMode |
UINT | postProcessingOutputMode |
VectorFloat | processedData |
Protected Attributes inherited from MLBase | |
bool | trained |
bool | useScaling |
DataType | inputType |
DataType | outputType |
UINT | baseType |
UINT | numInputDimensions |
UINT | numOutputDimensions |
UINT | numTrainingIterationsToConverge |
UINT | minNumEpochs |
UINT | maxNumEpochs |
UINT | validationSetSize |
Float | learningRate |
Float | minChange |
Float | rootMeanSquaredTrainingError |
Float | totalSquaredTrainingError |
Float | validationSetAccuracy |
bool | useValidationSet |
bool | randomiseTrainingOrder |
VectorFloat | validationSetPrecision |
VectorFloat | validationSetRecall |
Random | random |
std::vector< TrainingResult > | trainingResults |
TrainingResultsObserverManager | trainingResultsObserverManager |
TestResultsObserverManager | testResultsObserverManager |
Protected Attributes inherited from GRTBase | |
std::string | classType |
DebugLog | debugLog |
ErrorLog | errorLog |
InfoLog | infoLog |
TrainingLog | trainingLog |
TestingLog | testingLog |
WarningLog | warningLog |
GRT MIT License Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition at line 38 of file PostProcessing.h.
typedef std::map< std::string, PostProcessing*(*)() > PostProcessing::StringPostProcessingMap |
This typedef defines a map between a string and a PostProcessing pointer.
Definition at line 183 of file PostProcessing.h.
PostProcessing::PostProcessing | ( | void | ) |
Default Constructor
Definition at line 37 of file PostProcessing.cpp.
|
virtual |
Default Destructor
Definition at line 47 of file PostProcessing.cpp.
bool PostProcessing::copyBaseVariables | ( | const PostProcessing * | postProcessingModule | ) |
This copies the PostProcessing variables from postProcessingModule to the instance that calls the function.
postProcessingModule | a pointer to a post processing module from which the values will be copied |
Definition at line 54 of file PostProcessing.cpp.
|
static |
This static function will dynamically create a new PostProcessing instance from a string.
postProcessingType | the name of the PostProcessing class you want to dynamically create |
Definition at line 28 of file PostProcessing.cpp.
PostProcessing * PostProcessing::createNewInstance | ( | ) | const |
This static function will dynamically create a new PostProcessing instance based on the type of this instance
Definition at line 169 of file PostProcessing.cpp.
|
inlinevirtual |
This is the base deepCopyFrom function for the PostProcessing modules. This function should be overwritten by the derived class.
postProcessing | a pointer to the PostProcessing base class, this should be pointing to another instance of a matching derived class |
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 57 of file PostProcessing.h.
bool PostProcessing::getInitialized | ( | ) | const |
Returns true if the post processing module has been initialized correctly.
Definition at line 193 of file PostProcessing.cpp.
bool PostProcessing::getIsPostProcessingInputModeClassLikelihoods | ( | ) | const |
Definition at line 201 of file PostProcessing.cpp.
bool PostProcessing::getIsPostProcessingInputModePredictedClassLabel | ( | ) | const |
Definition at line 197 of file PostProcessing.cpp.
bool PostProcessing::getIsPostProcessingOutputModeClassLikelihoods | ( | ) | const |
Definition at line 209 of file PostProcessing.cpp.
bool PostProcessing::getIsPostProcessingOutputModePredictedClassLabel | ( | ) | const |
Definition at line 205 of file PostProcessing.cpp.
UINT PostProcessing::getNumInputDimensions | ( | ) | const |
Returns the size of the input vector expected by the post processing module.
Definition at line 185 of file PostProcessing.cpp.
UINT PostProcessing::getNumOutputDimensions | ( | ) | const |
Returns the size of the vector that will be computed by the post processing module.
Definition at line 189 of file PostProcessing.cpp.
UINT PostProcessing::getPostProcessingInputMode | ( | ) | const |
Definition at line 177 of file PostProcessing.cpp.
UINT PostProcessing::getPostProcessingOutputMode | ( | ) | const |
Definition at line 181 of file PostProcessing.cpp.
std::string PostProcessing::getPostProcessingType | ( | ) | const |
Definition at line 173 of file PostProcessing.cpp.
VectorFloat PostProcessing::getProcessedData | ( | ) | const |
Definition at line 213 of file PostProcessing.cpp.
|
protected |
Initializes the base postprocessing module, this will resize the processedData vector and get the instance ready for processing new data. The inheriting class must first initialize the module before calling this function.
Definition at line 78 of file PostProcessing.cpp.
|
virtual |
This saves the post processing settings to a file. This function should be overwritten by the derived class.
file | a reference to the file to save the settings to |
Reimplemented from MLBase.
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 109 of file PostProcessing.cpp.
|
inlinevirtual |
This loads the post processing settings from a file. This function should be overwritten by the derived class.
file | a reference to the file to load the settings from |
Reimplemented from MLBase.
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 117 of file PostProcessing.h.
|
protected |
Loads the core postprocessing settings from a file.
Definition at line 138 of file PostProcessing.cpp.
|
inlinevirtual |
This is the main processing interface for all the post processing modules and should be overwritten by the inheriting class.
inputVector | a vector containing the data that should be processed |
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 73 of file PostProcessing.h.
|
inlinevirtual |
This function is called by the GestureRecognitionPipeline's reset function and will reset the PostProcessing module. This function should be overwritten by the derived class.
Reimplemented from MLBase.
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 81 of file PostProcessing.h.
|
virtual |
This saves the post processing settings to a file. This function should be overwritten by the derived class.
filename | the filename to save the settings to |
Reimplemented from MLBase.
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 95 of file PostProcessing.cpp.
|
inlinevirtual |
This saves the post processing settings to a file. This function should be overwritten by the derived class.
file | a reference to the file to save the settings to |
Reimplemented from MLBase.
Reimplemented in ClassLabelTimeoutFilter, ClassLabelFilter, and ClassLabelChangeFilter.
Definition at line 108 of file PostProcessing.h.
|
protected |
Saves the core postprocessing settings to a file.
Definition at line 124 of file PostProcessing.cpp.