Ask Your Question

sdika's profile - activity

2015-07-27 10:28:56 -0500 commented answer load/save SVM custom kernel

thanks for the answers:

  1. obviously
  2. I am starting to work with custom kernels, there is really nothing worthwhile to contribute
  3. I though about it, but I save my data (including the svm object) in a const function
  4. I don't want t go into this.

actually, if the line "( kernelType == CUSTOM ) ... " was not here, it would load the svm object and I would set the kernel to mine.

I will try maybe the your 3 (but messing with const), I will also try another workaound: save/load only the sv and the alpha

thank anyway!

2015-07-27 09:25:35 -0500 received badge  Student (source)
2015-07-27 09:23:24 -0500 asked a question 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?

2015-05-13 08:37:45 -0500 received badge  Nice Answer (source)
2015-05-13 08:00:08 -0500 received badge  Editor (source)
2015-05-13 01:57:08 -0500 received badge  Teacher (source)
2015-05-12 10:23:38 -0500 received badge  Necromancer (source)
2015-05-12 10:23:02 -0500 answered a question HoG Descriptor: signed 0-360 orientation bins?

Hi,

I made a contribution to opencv for this that has just been included. If you git clone opencv, there is now a boolean variable signedGradient in HogDescriptor. set it to true...

Here is a link to the pull request: https://github.com/Itseez/opencv/pull...