Random Forest - Vector subscript out range during training
I am trying OpenCV (3.0) random forest implementation for the first time. The forest->train always throws the "vector subscript out of range error". My code is here,
cv::ml::RTrees::Params params = cv::ml::RTrees::Params::Params();
cv::Ptr<cv::ml::RTrees> forest = cv::ml::RTrees::create();
forest->train(trainingData, cv::ml::ROW_SAMPLE, trainingClass);
The trainingData is (CV_32F, 1,24,1800) and the trainingClass is (CV_32F, 1,1,1800). 24 is the number of features and 1800 is the total number of samples.
Even if I changed the layout to COL_SAMPLE, it throws an error like " Assertion failed <<layout =="ROW_SAMPLE" &&="" responses.rows="=" nsamples=""> || <layout =="COL_SAMPLE" &&="" responce.cols="=" nsamples="">
Where am I wrong?. Please suggest a solution.
(CV_32F, 1,24,1800)
meant to mean exactly ? please show, how you setup your dataThanks Berek. This is how my data are initialized,
The total samples may be any value (say 1800). The values of the trainingData and trainingClass are updated using a forloop.
your code runs fine here.
Thanks for testing. I am still having the same issue. Could it be a dll problem?