Ask Your Question

How to train a svm?

asked 2015-04-11 14:19:05 -0500

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-13 03:54:50 -0500

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

edit flag offensive delete link more



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 ( 2015-04-13 04:04:32 -0500 )edit

ou, sorry for wrong information

fedor gravatar imagefedor ( 2015-04-13 10:57:53 -0500 )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 ( 2015-04-14 00:39:11 -0500 )edit

And there are also OpenCV based implementations available

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-14 01:40:01 -0500 )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 ( 2015-04-23 03:29:57 -0500 )edit

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

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-23 03:58:24 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2015-04-11 14:19:05 -0500

Seen: 455 times

Last updated: Apr 13 '15