OpenCV Error: Bad argument [closed]

asked 2014-01-18 10:05:16 -0600

jossyy gravatar image

Hello , I have a problem.My compiler says : OpenCV Error: Bad argument (While cross-validation one or more of the classes have been fell out of the sample.

My response datas : labels(0, 0) = 1.000000 labels(1, 0) = -1.000000 labels(2, 0) = 1.000000 labels(3, 0) = -1.000000 labels(4, 0) = -1.000000 labels(5, 0) = 1.000000 labels(6, 0) = -1.000000 labels(7, 0) = 1.000000

http://code.opencv.org/issues/3194 This link says that this is a bug, but I am not clear.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by StevenPuttemans
close date 2014-01-23 07:18:38.787207

Comments

SVM.train_auto(trainingDataMat, labels, Mat(), Mat(), params);

I change train method's name as train, the error is not occurred.

jossyy gravatar imagejossyy ( 2014-01-18 10:12:14 -0600 )edit
2

the default value for k_fold in train_auto is 10. that means, it wants to do a 10 fold crossvalidation, so you need at least 5 items per class. you only got 4 per class.

if you don't want the cross-validation, use the train() method.

berak gravatar imageberak ( 2014-01-19 09:42:20 -0600 )edit

ok, I understand , thank you...

jossyy gravatar imagejossyy ( 2014-01-19 12:11:53 -0600 )edit

Closing topic due to being solved!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 07:18:17 -0600 )edit