SVM for emotion detection [closed]

asked 2015-04-24 05:35:39 -0600

amit shah gravatar image

I am working on emotion detection with landmark points detected. I now want to train SVM for emotion classification(happy, angry, fear, ) with these landmark points and then make SVM capable of detecting emotion in images. Being a novice to SVM, I tried using a simple SVM example already available for OpenCV C++. It works for classification into either of two regions depending on the point location. Also, I expected a .xml file of trained model (eg: lbpcascade_frontalface.xml which is trained on LBP features is already available in opencv) to be generated for future use. But no such file was generated.

How do we generate such a file for future use ? And is it possible to classify images into various classes depending using SVM.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-07 13:07:08.871094

Comments

2
  • "How do we generate such a file for future use" - after successful training, you can just svm->save(filename) and later svm->load(filename); (instead of re-training)

  • "And is it possible to classify images into various classes ?" - sure. just have like 0=sad, 1=neutral, 3=happy for the labels you feed into the svm for training.

(just curious : what are you using for the landmarks ?)

berak gravatar imageberak ( 2015-04-24 06:09:16 -0600 )edit

I am using flandmark detector library to locate landmark points. Is there another way to locate them? Labelling is not an issue, bt how do I train the network? Is it using the location of these landmark points or entire images or with some other method. I saw suggestion that features extracted using HOG, LBP should be fed to SVM model. Could you suggest.

amit shah gravatar imageamit shah ( 2015-04-24 06:22:26 -0600 )edit

flandmarks has only 8 points, right ? that might not be enough. maybe have a look at dlib there.

also, you probably need to normalize your points, e.g. subtracting the most top/left point, and scale by boundingbox

yes, hog or lbp features are an alternative. once you got your train/test pipeline set up, it will be easy to switch features, to see what serves your need better.

berak gravatar imageberak ( 2015-04-24 06:35:06 -0600 )edit

I am working on locatimg more landmark points. Will have a look at dlib. After I have detected the points, what do I need to train my SVM model with ? Is it that these points would prove better or should I feed in images directly ? Is there some tutorial to assist me with it.

amit shah gravatar imageamit shah ( 2015-04-24 09:06:38 -0600 )edit

yes, the points.

(if you use the images for features, there's no point in using flandmark, no ? [sorry for the pun ;])

berak gravatar imageberak ( 2015-04-24 09:12:51 -0600 )edit

In any case do you know, how do I go about it ? Not enough information is available for it.

amit shah gravatar imageamit shah ( 2015-04-26 23:59:15 -0600 )edit

@berak: Tried using landmarks detected using dlib. These landmark locations along with the label coressponding to each image was fed to SVM and trained. It does not allow a very efficient model. Is there any other method which can be used ? How can LBP or HOG features be extracted for training model ?

amit shah gravatar imageamit shah ( 2015-05-08 06:21:59 -0600 )edit

"It does not allow a very efficient model" - efficient means here ? bad prediction ?

(maybe you need to tweak it a bit, like using selected points only (not the outline, but those around mouth/eyes), also, finding good svm params is a science of it's own !!)

but yes, you can use HogDescriptor::compute() to get Hog features, and there's lbp features in opencv's face recognition code.

berak gravatar imageberak ( 2015-05-08 06:48:15 -0600 )edit

When I say not efficient, I meant it give false classification. Eg: Sad image was classified as being happy and so on. I used only the relevant landmark points for SVM training. I feel training it with something other than landmark points may prove better. Which alternative method should I follow ? Also, how do I use HOG or LBP features to train the model !

amit shah gravatar imageamit shah ( 2015-06-03 05:13:34 -0600 )edit

did you normalize the points ? (like subtracting the tl-corner of the bounding box, then dividing by size, to get them into [0..1] range .

also, try different svm kernels, and svm.train_auto()

berak gravatar imageberak ( 2015-06-03 05:17:52 -0600 )edit