Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

load/save SVM custom kernel

Hi,

I am trying to train a SVM on some feauture using a custom kernel with opencv. Everything is ok for the training part: I extract the feature, train the SVM, save the results to a file with SVM::save.

The problem is when I try to use it: when I want to load the SVM from the file I get:

OpenCV Error: Parsing error (Invalid SVM kernel type (or custom kernel)) in read_params, file /myopt/opencv/opencv-3.0.0/modules/ml/src/svm.cpp, line 2112
terminate called after throwing an instance of 'cv::Exception'
  what():  /myopt/opencv/opencv-3.0.0/modules/ml/src/svm.cpp:2112: error: (-212) Invalid SVM kernel type (or custom kernel) in function read_params

and indeed in modules/ml/src/svm.cpp there is
if( kernelType == CUSTOM ) CV_Error( CV_StsParseError, "Invalid SVM kernel type (or custom kernel)" );

I don't understand this. How can I save and then load the result of my training?