在交叉验证中,一个或多个类别已从样本中剔除

时间:2018-09-09 08:32:03

标签: c++ opencv svm

我正在尝试使用opencv trainauto来训练SVM,当训练数据矩阵小于4行时,一切都很好,但是当出现上述错误时,

OpenCV Error: Bad argument (While cross-validation one or more of the classes have been fell out of the sample. Try to reduce <Params::k_fold>) in do_train

这是我使用的部分代码:

 svm = SVM::create();
 std::cout<<"creation of svm done\n";
 svm->setType(SVM::C_SVC);
 svm->setKernel(SVM::RBF);
 if(Motionsvm_training_data.type() != CV_32F)           Motionsvm_training_data.convertTo(Motionsvm_training_data,CV_32F);
  // Train the SVM with given parameters
Ptr<TrainData> td = TrainData::create(Motionsvm_training_data, ROW_SAMPLE,MotionfaceLabels);
svm->trainAuto(td);

请帮助..谢谢

0 个答案:

没有答案