Response is not integral
Hi All,
I am solving a multi-class classification problem using C_SVC type. After inputting data into my training_matrix (matrix for data) and training_labels_matrix (matrix for data's labels), I used train_auto to train the SVM.
Mat training_matrix(TRAINING_ROWS,2,CV_32FC1);
Mat training_label_matrix(TRAINING_ROWS,1,CV_32FC1);
//Above matrices are filled with data here
// ....
// ...
float weight[3] = {Parameter_C,Parameter_C,Parameter_C};
Mat weights(3,1,CV_32FC1,weight);
CvMat _weight = weights;
CvMat *_weightPtr = &_weight;
//Specify SVM Parameters
CvSVMParams params;
params.svm_type = CvSVM::C_SVC;
params.kernel_type = CvSVM::RBF;
params.class_weights = _weightPtr;
params.gamma = Gamma;
//Train the SVM
CvSVM SVM;
SVM.train_auto(training_matrix, training_label_matrix, Mat(), Mat(), params, 1000,
CvSVM::get_default_grid(CvSVM::C), CvSVM::get_default_grid(CvSVM::GAMMA)); <- Program crashed here
However, the error "OpenCV Error: Bad argument (response #0 is not integral) in cvPreprocessCategoricalResponses, file /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.6/modules/ml/src/inner_functions.cpp, line 715 terminate called throwing an exception(lldb)" comes up and I have no idea how to proceed.
Please help!
Thank you so much...
Maybe give some code snippets and give a hint where it crashes.
Edited my post to show code snippets. (I have 600 rows of training data and also 600 rows of training data labels)
Couldnt you try to debug the code and tell us at which line it crashes?
Hi, the program crashed at SVM.train_auto(training_matrix, training_label_matrix, Mat(), Mat(), params, 1000,CvSVM::get_default_grid(CvSVM::C), CvSVM::get_default_grid(CvSVM::GAMMA));
I have the same trouble, and I have no idea what should I do to fix this bug. Hope someone can help :D
I am getting this error if I save a SVM, then try to load it and keep training on it. Is this not possible?