Ask Your Question
1

Read svm data and re-train with more data

asked 2014-10-06 11:40:57 -0600

adhitomax gravatar image

updated 2014-10-07 02:52:18 -0600

berak gravatar image

I am implementing a facial expression recognition and am using SVM to classify given expression. When I train, I use this command line

svm.train(myFeatureVector,myLabels,Mat(),Mat(), myParameters);
svm.save("myClassifier.yml");

which will later when I will predict using

response = svm.predict(incomingFeatureVector);

But then when I want to train more than once (exited the program and start again), it seems to have overwritten my previous svm file. Is there any way I could do read previous svm file and add more data into it (and then resave it ,etc) ? I looked up on this openCV documentation and found nothing. However, when I read on this page; there is a method called CvSVM::read. I don't know what that does/how to implement it.

Hope anyone can help me :(

edit retag flag offensive close merge delete

Comments

1

since your data does not really change, i don't understand, why you want to retrain this at all.


wouldn't it be sufficient, to train this once on a significantly large db, and leave it at that ?

( then, instead of calling svm.train(), and svm.save() you'd just call svm.read("myClassifier.yml"); )

berak gravatar imageberak ( 2014-10-07 02:49:23 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-10-07 02:39:43 -0600

Guanta gravatar image

You cannot incrementally train an SVM classifier. The save and read functions can be used to save an SVM to harddisk and later use it for prediction. Thus, you need to train it once for all the descriptors of your training set. Guess, from OpenCV you can only use MLP for online learning (maybe I am wrong here).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-06 11:40:57 -0600

Seen: 766 times

Last updated: Oct 07 '14