Saikat
Saikat

Reputation: 1219

CvSVM.predict() gives 'NaN' output and low accuracy

I am using CvSVM to classify only two types of facial expression. I used LBP(Local Binary Pattern) based histogram to extract features from the images, and trained using cvSVM::train(data_mat,labels_mat,Mat(),Mat(),params), where,

data_mat is of size 200x3452, containing normalized(0-1) feature histogram of 200 samples in row major form, with 3452 features each(depends on number of neighbourhood points)

labels_mat is corresponding label matrix containing only two value 0 and 1. The parameters are:

CvSVMParams params;

params.svm_type     =CvSVM::C_SVC;
params.kernel_type  =CvSVM::LINEAR;
params.C            =0.01;
params.term_crit=cvTermCriteria(CV_TERMCRIT_ITER,(int)1e7,1e-7);

The problem is that:-

  1. while testing I get very bad result (around 10%-30% accuracy), even after applying with different kernel and train_auto() function.

  2. CvSVM::predict(test_data_mat,true) gives 'NaN' output

How to resolve this?

Upvotes: 4

Views: 766

Answers (2)

Mostafa Sataki
Mostafa Sataki

Reputation: 305

The SVM generalization power is low.In the first reduce your data dimension by principal component analysis then change your SVM kerenl type to RBF.

Upvotes: 1

Andrey  Smorodov
Andrey Smorodov

Reputation: 10850

I suppose, that your classes linearly hard/non-separable in feature space you use. May be it will be better to apply PCA to your dataset before classifier training step and estimate effective dimensionality of this problem. Also I think it will be userful test your dataset with other classifiers. You can adapt for this purpose standard opencv example points_classifier.cpp. It includes a lot of different classifiers with similar interface you can play with.

Upvotes: 1

Related Questions