Crash at boost.load()

asked 2013-07-26 08:05:53 -0500

Hey, today I tried to train boost classifier. During the training everything is OK.

  CvMLData cvml;
  cvml.read_csv ("boost.csv");
  cvml.set_response_idx (0);

  CvTrainTestSplit cvtts (150, true);
  cvml.set_train_test_split (&cvtts);

  printf ("Training ... ");
  CvBoost boost;
  boost.train (&cvml, CvBoostParams(CvBoost::DISCRETE, 100, 0, 1, false, 0),false);
  std::vector<float> train_responses, test_responses;
  float fl1 = boost.calc_error (&cvml, CV_TRAIN_ERROR, &train_responses);
  float fl2 = boost.calc_error (&cvml, CV_TEST_ERROR, &test_responses);

  cout<<"Error train: "<<fl1<<endl;
  cout<<"Error test: "<<fl2<<endl;

  boost.save ("trained_boost.xml", "boost");

But after the training, when i tried to load the saved XML file, the test app crashes...

for(unsigned int i=0;i<descriptorsValues.size();i++)
    data.at<float>(1,i)=descriptors[i];

CvBoost boost;
cout<<argv[1]<<endl; //path is OK
boost.load(argv[1]);//but never "Load OK"

cout<<"Load OK"<<endl;

float x = boost.predict(data,Mat(),Range::all(),false,false);

cout<<"Result:"<<x;
system("PAUSE");

Any idea ?

edit retag flag offensive close merge delete