Ask Your Question

Killerwife's profile - activity

2016-05-26 07:16:29 -0500 asked a question Boost custom weak classifiers

Hello, I am trying to implement my own weak classifiers in connection with AdaBoost. Currently I am unable to figure out any way using cv::ml:boost. Am I missing something or does this algorithm implementation only support decision trees?

My goal is to implement my own flavor of haar features and/or use my own HOG implementation.

I apologis

2016-04-06 11:38:20 -0500 commented answer OpenCV 3 Boost train help

Yes, that fixed the problem. Now I need to figure out why my XML weights are only 0 and 0. but thats a different issue completely. Thank you.

2016-04-06 11:37:38 -0500 received badge  Supporter (source)
2016-04-06 11:20:31 -0500 commented answer OpenCV 3 Boost train help

I am trying to do a classification. So I need to convert responses array to integers?

2016-04-06 09:15:53 -0500 commented question OpenCV 3 Boost train help

I added a link to some uploaded sample data.

2016-04-06 09:15:31 -0500 received badge  Editor (source)
2016-04-06 01:09:04 -0500 asked a question OpenCV 3 Boost train help

I am trying to train my own AdaBoost for object detection. I have compiled this code from examples but I encountered a problem.

cv::Mat* data=nullptr;
cv::Mat* responses = nullptr;
parser.toMat(&data,&responses);
cv::Ptr<cv::ml::Boost> boost = cv::ml::Boost::create();
boost->setBoostType(cv::ml::Boost::DISCRETE);
boost->setWeakCount(100);
boost->setWeightTrimRate(0.95);
boost->setMaxDepth(2);
boost->setUseSurrogates(false);
boost->setPriors(cv::Mat());
boost->train(cv::Mat(*data), cv::ml::ROW_SAMPLE, cv::Mat(*responses));
boost->save("trainedBoost.xml");

This error pops up when I use the train function "Expression: vector subscript out of range" It occurs on this line: err += wval*(result[i] != w->cat_responses[si]); in opencv_ml310d.dll!cv::ml::DTreesImplForBoost::updateWeightsAndTrim(int treeidx, std::vector<int,std::allocator<int> > & sidx) Line 235 C++

My data and responses cv::Mats have the exact same amount of rows. Responses is a cv::Mat with one collumn, containing a 0 or 1 depending on the class of each sample. Data mat is a cv::Mat of images I am trying to train on, each containing a person if its a positive sample. The format of the data cv::Mat consists of one image in each row of the cv::Mat.

I have compiled the latest opencv 3 from GitHub and to my knowledge it was compiled correctly thus far. Any ideas where I should look for an error?

Sample Data (using cv::FileStorage) in yml Sample Data