SVM for emotion detection [closed]
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.
"How do we generate such a file for future use" - after successful training, you can just
svm->save(filename)
and latersvm->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 ?)
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.
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.
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.
yes, the points.
(if you use the images for features, there's no point in using flandmark, no ? [sorry for the pun ;])
In any case do you know, how do I go about it ? Not enough information is available for it.
@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 ?
"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.
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 !
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()