nickgillian / grt

gesture recognition toolkit
859 stars 285 forks source link

How to reject null gestures using continuous HMM #89

Open JairoJs opened 8 years ago

JairoJs commented 8 years ago

Hello, I got this continuous HMM model that classifies perfectly the 8 classes It has been trained for, but the problem is that it does not reject any of the non gestures I present to the model, I am aware that hmm does not support auto gesture spotting, anyhow I did try enabling the null rejection feature and setting a rejection coeff but as expected didnt work. Is there a way I can help the classifier to reject non gestures?

daniellocust commented 7 years ago

Hi, JairoJs: I have applied DTW algorithm in my gesture recognition project, and the effect was not bad, the program can classify 6 classes. Now, I applied continuous HMM to my project, but the effect is very bad. None class can be classified by HMM, and all gestures are recognised as null, just opposite result with you. So, may i ask you what parameters you set? Such as downsamplefactor, committeesize, autoestimatesigma, sigma delta, etc. Thanks!

JairoJs commented 7 years ago

Hello, after a while trying to fix the issue, I switch to a DTW classifier too. However the parameters I used in HMM were, downsample 3, committe 10, autosigma true, delta 1. the dataset was 100 samples of each class (8 classes). I used 10 fold cross validation for training phase. The data was pre processed and normalized before feeding it to the classifier.

JairoJs commented 7 years ago

As I told you, I switch to DTW, and is working quite well, almost perfect. The trick I did there was to train a DTW model for each class, so I get 8 classiffier models that perform predictions in cascade, I am a novice at all of this machine learning-gesture recognition thing so I dont know if that was a good practice, but as I said it is doing the job. Hope I could help, keep me update. Cheers

daniellocust commented 7 years ago

Thanks for your reply! here are my parameters: m_hmm.setHMMType(HMM_CONTINUOUS); m_hmm.setDownsampleFactor(5); m_hmm.setCommitteeSize(10); m_hmm.setAutoEstimateSigma(true); m_hmm.setSigma(20.0); m_hmm.setModelType(HMM_LEFTRIGHT); m_hmm.setDelta(1); m_hmm.enableNullRejection(true); I am a novice to this field too, so I want to commuicate with anyone working in this kind project. Thanks again!

daniellocust commented 7 years ago

Hi, JairoJs! These days I studied the continous HMM, and found some bugs in the implement. After fixed these bugs, the continous HMM works well for me. Followings are the bugs I fixed:

  1. in ContinuousHiddenMarkovModel::predict_(..) function, the c[t] = 1.0/c[t] should be changed to : if (c[t] == 0) c[t] = DBL_MAX; else c[t] = 1.0/c[t];
  2. in ContinousHiddenMarkovModel::gauss(...) function, the algorithm should be changed to : z _= (1.0/( sigma[i][n] * SQRT_TWO_PI )) * exp( - SQR(x[i][n]-y[j][n])/SQR(2.0_sigma[i][n]) ); the number "2" should be included in SQR function.