标签:保存 ror href which ref question ring https span
VS2019+OpenCV4.0
在完成分类器的训练,直接predict是没有问题的,但是保存xml文件后,再用以下的语句加载训练好的xml模型,predict出现了问题。
svm->save("svm.xml")
svm->load<SVM>("trained-svm.xml");
OpenCV Error: Assertion failed (samples.cols == var_count && samples.type() == CV_32F) in cv::ml::SV
在以下链接找到了解决办法。
https://answers.opencv.org/question/103031/opencv-31-c-svmload-does-not-set-var_count-correctly/
SVM::load() is a static function, which returns a new instance.
you have to use it like:
svm = Algorithm::load<SVM>("svm.xml");
改成以上语句后predict成功!
OpenCV Error: Assertion failed (samples.cols == var_count && samples.type() == CV_32F) in cv::ml::SV
标签:保存 ror href which ref question ring https span
原文地址:https://www.cnblogs.com/leoking01/p/13523630.html