OpenCV Error: Bad argument [closed]

asked Jan 18 '14

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.

Preview: (hide)

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 (Jan 18 '14)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 (Jan 19 '14)edit

ok, I understand , thank you...

jossyy gravatar imagejossyy (Jan 19 '14)edit

Closing topic due to being solved!

StevenPuttemans gravatar imageStevenPuttemans (Jan 23 '14)edit