SVM training error
Now I train SVM with SURF feature for face recognition. During training I got an error like this:
OpenCV Error: Sizes of input arguments do not match (Response array must contain as many elements as the total number of samples) in cvPreprocessCategoricalResponses, file /home/arya/stuff/opencv/opencv-2.4.7/modules/ml/src/inner_functions.cpp, line 671 terminate called after throwing an instance of 'cv::Exception' what(): /home/arya/stuff/opencv/opencv-2.4.7/modules/ml/src/inner_functions.cpp:671: error: (-209) Response array must contain as many elements as the total number of samples in function cvPreprocessCategoricalResponses
I don't understand what this error exactly mean by.Could anyone explain me why I got error like this?
for, say, 17 SURF features you should have a 17x128 trainData Mat, and a 17x1 trainLabels Mat
maybe you can show us, how you fill the labels ?
I gave +1 for positive images and -1 for negative images. Few examples are shown below. /home/arya/Images/OutputImage/im1.pgm;1 /home/arya/Images/OutputImage/im2.pgm;1 /home/arya/Images/OutputImage/im3.pgm;1 /home/arya/Images/OutputImage/im4.pgm;1 /home/arya/Images/OutputImage/im5.pgm;1 /home/arya/Images/OutputImage/im46.pgm;-1 /home/arya/Images/OutputImage/im47.pgm;-1 /home/arya/Images/OutputImage/im48.pgm;-1 /home/arya/Images/OutputImage/im49.pgm;-1 /home/arya/Images/OutputImage/im50.pgm;-1 /home/arya/Images/OutputImage/im51.pgm;-1 /home/arya/Images/OutputImage/im52.pgm;-1
Thank you..I solved my error. As you said, my problem is in trainData Mat and trainLabels Mat.