Hello,
I trained an SVM model and save it in xml file, everythink look good. but when I load the model I print the getvar vaule its equal to 0?
The model file looks fine to me?3 C_SVC LINEAR 1.0000000000000001e-01 1.1920928955078125e-07 1000 4096 2 2 1 i
1 21 <_>
-6.66133815e-15 -4.88498131e-15 -3.33066907e-15 -3.33066907e-15 0.
This is a part of the train code :
Ptr Model = ml::SVM::create();
Ptr TrainData = ml::TrainData::create(Data, ml::ROW_SAMPLE, Label);
Model->setType(SVM);
Model->setKernel(Kernel);
Model->trainAuto(TrainData,5);
Model->save((*path));
Test part in other project :
Ptr classifier = ml::SVM::create();
classifier->load(*modelPath);
Mat features = (*featuresSptr)[i];
features.convertTo(features, CV_32F);
float label = classifier->predict(features);
error :
> OpenCV Error: Assertion failed> (samples.cols == var_count &&> samples.type() == CV_32F) in predict
↧