nickgillian / grt

gesture recognition toolkit
859 stars 285 forks source link

Deriviate in preprocessing module returns false? #95

Open leekingly opened 7 years ago

leekingly commented 7 years ago

Hi,Nick as mentioned in title,I got some troubles in grt,if I don't use Derivative in PreProcessingModule,pipeline will train the dataset as well,but if I add this module,the result of pipeline-train is false,below is my code: //--------------initialize the gesture recognition pipeline----------- pipeline.addPreProcessingModule(MovingAverageFilter(5, 6)); pipeline.addPreProcessingModule(Derivative(Derivative::FIRST_DERIVATIVE, 30/1000, 6, false)); pipeline.addPostProcessingModule(ClassLabelTimeoutFilter(3000, ClassLabelTimeoutFilter::INDEPENDENT_CLASS_LABELS)); as code above,I add PreProcessingModule use Derivative,but when I train the pipeline ,it returns false to me。I track the code ,and find it return false here: if( !preProcessingModules[moduleIndex]->process( sample ) ){ errorLog << "train(TimeSeriesClassificationData trainingData) - Failed To PreProcess Training Data. PreProcessingModuleIndex: "; errorLog << moduleIndex; errorLog << std::endl; return false; } if you need my trainingdata.txt,please let me know,TKS!

leekingly commented 7 years ago

trainingdata.txt

leekingly commented 7 years ago

the picture is the screenshot of ErrorMessage print out. 1

![Uploading 3.png…]()

leekingly commented 7 years ago

3

leekingly commented 7 years ago

I find if don't use the following code: dtw.enableTrimTrainingData(true, 0.1, 95) pipeline can train sucessfully with derivate preprocessingModule,if open this code,pipeline will prompt "the first index is greater than the last index".

leekingly commented 7 years ago

Hi,Nick I have read the parameter of: bool enableTrimTrainingData(bool trimTrainingData,double trimThreshold,double maximumTrimPercentage); I am not sure the trimThreshold and maximumTrimPercentage mean what?could you help me explain it in detail? screen

nickgillian commented 7 years ago

The trim function attempts to remove sections of no movement at the start and/or end of a time series (a.k.a. gesture).

These periods of no movement can be artifacts of how recordings are captured, e.g., you press the record button, think for a second which gesture you are going to perform, perform it, then pause for another second while you try and hit the 'stop' button. This would cause around 1 second of none movement at both the start/end of your recording, which is not useful data to input to the ML algorithm as it will learn to detect these periods of no movement....and will therefore give bad results if it does not see these periods of no movement in the live/test data.

Enabling trimming therefore tries to avoid this by searching for periods of no movement at the start/end of a file and removing it. This works by computing the amount of change in the input timeseries, normalizing the signal based on the max-change, then scanning forward from the start of the timeseries to see if the normalized change signal is below the trimThreshold. If the signal is below the trimThreshold, then the signal will be trimmed to the point where the signal exceds the threshold. The algorithm does the same from the end of the timeseries as well.

If the length of the new length of the timeseries is less than the maximum trim percentage, then the timeseries will be trimmed.

You can see the actual algorithm that does this here.