Training SVM and saving data [closed]
Hello.
I switched from Java to C++ because of performance in my application, but I am having trouble when training SVM. It take a long time to load 4500+ images, and then the SVM is trained instantly, with true result. This is strange (at least for me), but I cannot save the resulting data.
When I call the method svm->save("output.xml");
it results the following error:
OpenCV(3.4.1) Error: Parsing error (SVM model data is invalid, check sv_count, var_* and class_count tags) in cv::ml::SVMImpl::write, file C:\Users\ponto\Documents\vcpkg-master\buildtrees\opencv\src\3.4.1-273ea13f6d\modules\ml\src\svm.cpp, line 2113
What is the cause of this error? And how can I solve it? Sorry if it is obvious, I am not a Cplupluxpert.
EDIT: This is the pastebin link to my code: https://pastebin.com/tq5Ldgpz
can we see your code, please ?
also, training may fail. did you check the return value from
svm->train()
?The link to the code is on the question now, and yes, I checked the result of the operation to see if it was successful.
mate did you fixed this problem ? i have the same issue and as you SVM is trained but the problem in saving.