Ask Your Question

Revision history [back]

Error with trainAuto

Hi,

I get an error "Floating point exception: 8" when I use trainAuto using the following code. How can this error be resolved?

cv::Mat matFeatures(batch_size, dim_features, CV_32F, rgFeatures); cv::Mat matLabels(batch_size, 1, CV_32F, rgLabels);

cv::Ptr<cv::ml::SVM> svm = cv::ml::SVM::create();
svm->setType(cv::ml::SVM::C_SVC);
svm->setKernel(cv::ml::SVM::LINEAR);
svm->setGamma(3);
svm->setTermCriteria(cv::TermCriteria(cv::TermCriteria::MAX_ITER+cv::TermCriteria::EPS, 10000, 1e-6));

cv::Ptr<cv::ml::TrainData> tData = cv::ml::TrainData::create(matFeatures, cv::ml::ROW_SAMPLE, matLabels);

svm->trainAuto(tData, 2);

Regards, Vishnu