So it is common knowledge that due to a bug in OpenCV when you try to load a non-linear kernel SVM after saving it you get an error.
Refer here for more: OpenCV 3.1.0: Save and load trained SVMs
People HAVE gotten the SVM to load but were unable to obtain the same result (classifier data was corrupted after loading). I tried testing this by writing my own svmloader function.
Ptr<SVM> svmloader(const String& filepath)
{
FileStorage fs;
fs.open(filepath, FileStorage::READ);
Ptr<SVM> svm = Algorithm::read<SVM>(fs.getFirstTopLevelNode());
return svm;
}
This works but I can as of now confirm that I've tested model pre and post loading and the results seem worse post-loading. That is after you train a classifier and you test it, it will be fine but if you save it and load it again it will get effed up.
So I think I want to use C++'s Object serialization to solve this problem. How can I write arbitary objects to a file and then read from that file?
Also can someone confirm if the above bug has been fixed in OpenCV 3.2.0 I COULD NOT FIND ANYTHING IN THE RELEASENOTES
Any help is GREATLY APPRECIATED folks