Schmelix
Schmelix

Reputation: 93

OpenCV SVM: Update a trained SVM

I am using OpenCV 2.4.6 ( the only Version which is available on this PC). So I have a SVM Modell with the default parameters which is already trained. Now I want to update it with new Samples.

CvSVM Support_VectorMachine;
Support_Vector_Machine.load(FilePath);


struct CvSVMParams Parameter;
Parameter = Support_Vector_Machine.get_params();

Support_Vector_Machine.train(TrainMatrix, Labels, cv::Mat(), cv::Mat(), Parameter);

So the Problem is, as mentioned in the OpenCV Statistical Models Dokumentation, that the train method calls the CvStatModel::clear() method, so my trained model gets overwritten.

Is there any solution or do I have to use a newer Version of open CV or another library for machine learning?

Thanks for your help.

Upvotes: 2

Views: 629

Answers (1)

Pedrom
Pedrom

Reputation: 3823

SVM is not an online algorithm. This means that it doesn't support incremental learning which is what you are trying to do. So if you want to add new points you must retrain the model again.

There are some variations of SVM that support online learning (i.e Pegasos SVM), but I don't think OpenCV implement them.

Upvotes: 1

Related Questions