First time here? Check out the FAQ!

Ask Your Question
0

How to train a svm?

asked Apr 11 '15

ajman gravatar image

I have three types of images namely, happy, sad and bored which contain a face corresponding to the each emotion. What kind of operation has to be done before the training? Can anyone provide me some reference code about training a svm?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Apr 13 '15

fedor gravatar image

To train svm you need to have Mat with features and Mat with lables ( 0 - happy, 1 - bored, 2 - sad ). But, I think, getting from images features for emotion characterization is too complicated. Read about Cascade Classifier or object detection

Preview: (hide)

Comments

3

Hmm I do not think this is the solution, why not go for solutions that have proved to work?

  1. Detect faces in image
  2. For each given face, training or detection, calculate facial landmarks, using specific libraries out there for that
  3. Now calculate a decent descriptor of those feature points based on spatial information and a relation to eachother
  4. Train SVM classifiers on that information, not on complete image information!
StevenPuttemans gravatar imageStevenPuttemans (Apr 13 '15)edit
1

ou, sorry for wrong information

fedor gravatar imagefedor (Apr 13 '15)edit

@StevenPuttemans: I have landmark points on faces detected. How do I use these points to train SVM for emotion detection. Could you provide some reference documents.

tomnjerry gravatar imagetomnjerry (Apr 14 '15)edit
1
1

And there are also OpenCV based implementations available

StevenPuttemans gravatar imageStevenPuttemans (Apr 14 '15)edit

@StevenPuttemans I have trained my SVM classifier, but how can I transfer is to a detector in openCV3.0? As I can not get the alpha, sv_count and rho from the trained SVM.xml defined as below:

Ptr<ml::SVM> svm = ml::SVM::create(params);
bruceyo gravatar imagebruceyo (Apr 23 '15)edit

One of the things I have not tackled yet is the new ML interface so I have no clue :)

StevenPuttemans gravatar imageStevenPuttemans (Apr 23 '15)edit

Question Tools

2 followers

Stats

Asked: Apr 11 '15

Seen: 602 times

Last updated: Apr 13 '15