0

I'm working on a face spoof detector using the research in the article called: "Face spoofing detection from single images using micro-texture analysis"

It's based on training an SVM using a uniform 59-bin LBP histogram of the face, with training database from http://parnec.nuaa.edu.cn/xtan/NUAAImposterDB_download.html. I made a simpler implementation just using 3x3 neighborhood of the entire face, because other research shows that simpler analysis works better when used in conjunction with other classifiers, which I am doing.

The problem I have now is that the predictor is not working at all; it always return 1 (i.e., real face), even for fake photos from the training database itself!

My suspicion is maybe the SVMParams are not correct. What are the proper params in this implementation? This is what I have now:

svmParams.svm_type = cv::SVM::C_SVC;
svmParams.kernel_type = cv::SVM::RBF;
jacob
  • 2,762
  • 1
  • 20
  • 49

1 Answers1

1

There is no such thing as proper parameter, without analyzing the data. If your data is linearly separable you can use linear kernel, if not RBF kernel will be better, or you can try others. In any case you need to find optimum parameters. C for linear kernel, C and gamma for RBF kernel. It looks like you didn't even set these parameters. Your problem is possibly the parameter but not the kernel type, kernel parameters. Please have a look at this.

EDIT

Also this and this might help you.

Community
  • 1
  • 1
guneykayim
  • 5,210
  • 2
  • 29
  • 61
  • Thank you. I'm working on this project without the essential background knowledge. I did set RBF for kernel, because that is what the research article cited above uses. Is train_auto a decent method for this, or are self-help methods more effective? – jacob Oct 31 '14 at 01:49
  • train_auto now returns all -1 (i.e., rejects as fake). Should I take a different approach, or might I be missing something else? – jacob Oct 31 '14 at 02:07
  • 1
    It'll be helpful if you posted your code/code structure. – a-Jays Oct 31 '14 at 04:49
  • One other thought is: Do I need to normalize the training values to range [0,1], or does train_auto deal with that internally? – jacob Nov 03 '14 at 02:32
  • So I scaled the feature values to (0,1) and the results are better. It's certainly not perfect at all, but it is more sensible. I think perhaps the main issue now is the quality of test data. I am training with the antispoof database cited in my original question, and my real world test data does not look so much the same. I am trying to supplement with training data from my real world scenarios, but it seems I need a LOT of photos to affect the decision boundary enough to really improve it. – jacob Nov 03 '14 at 13:37
  • how did you do the scaling? You should scale the train data, and obtain some parameters, then scale the test data using those parameters. Did you do that? – guneykayim Nov 03 '14 at 15:04
  • When I wrote my last comment, I was scaling to (0,1) based on global min-max across all features, and was scaling test data with same values. Then I came across the following code which does min-max for each feature separately and scales to (-1,1): https://github.com/bioidiap/antispoofing.lbp/blob/master/antispoofing/lbp/script/svmtrain_lbp.py Of course, that makes more sense, and re-factoring to do it that way, I am seeing further improvement in results. There definitely can be more improvement, and I'm wondering if I just need better data? – jacob Nov 04 '14 at 01:41
  • I'm definitely finding now that as I create more training data, it is improving a lot. – jacob Nov 06 '14 at 20:44