Quantcast
Viewing all articles
Browse latest Browse all 41027

OpenCV 3.0 Assertion fail while train boost model

Hi all, I am trying to train my own boosting model, but I encountered Assertion failed on trainning stage. My program is trying to read a CSV file into cv::Mat and use cv::Mat to be the input of trainning process. Following is my code: int main(int argc, char *argv[]){ int rows = 10; int cols = 4; string pixel; Mat img(Size(cols,rows),CV_32F); Mat response(Size(1,rows),CV_32F); ifstream file("D:/testFile2/test.csv", ifstream::in); for(int i=0; i(i); float* data2 = (float*)response.ptr(i); for(int j=0; j dataset = ml::TrainData::create(img,ml::SampleTypes::ROW_SAMPLE,response); Ptr boost = ml::Boost::create(); boost->setBoostType(ml::Boost::REAL); boost->setWeakCount(10); boost->setMaxDepth(2); boost->setWeightTrimRate(0.95); cout<<"Training data: "<getSamples()<getResponses()<(dataset,0); cout<<"Finished Boosting Trainning!!!"< dataset = ml::TrainData::loadFromCSV("D:/testFile2/test.csv",0,0); Then, everything is fine, no assertion failed occured. Does anyone have idea about this? Thanks

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>