Ask Your Question

Read svm data and re-train with more data

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

adhitomax gravatar image

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

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);"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



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 you'd just call"myClassifier.yml"); )

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

1 answer

Sort by ยป oldest newest most voted

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

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
Login/Signup to Answer

Question Tools


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

Seen: 612 times

Last updated: Oct 07 '14