How to SVM predict more than one sample?
I want to classify more than one single image with a SVM trained before. I know that there is the
void predict( cv::InputArray samples, cv::OutputArray results )
but I get the following error
OpenCV Error: Incorrect size of input array (Input sample must be 1-dimensional vector) in cvPreparePredictData, file /home/stefan/git_repos/opencv/modules/ml/src/inner_functions.cpp, line 1107
terminate called after throwing an instance of 'cv::Exception'
what(): /home/stefan/git_repos/opencv/modules/ml/src/inner_functions.cpp:1107: error: (-201) Input sample must be 1-dimensional vector in function cvPreparePredictData
if I have :
cv::Mat testPredictions;
Mat samples = testDLN.getBOWDescritprs(); // samples is a 90x150 Mat
m_classifier->predict(samples, &testPredictions);
How shall I classify the set of images? Shall I use a for loop instead?
Exactly, just iterate the rows with a for loop and then apply the predict every single time. There is no batch predict function for the moment.
I have seen the metioned overload of
predict
and I thought that it works... ThanksNo batch predict function? Then what does the predict function documentation mean when it says "Predicts response(s) for the provided sample(s)" implying that we can get multiple predictions for multiple samples/instances? http://docs.opencv.org/3.0-beta/modul...