Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

RTrees save fails when setPriors() used.

I am trying to train a model with a skewed data set. So tried using

setPriors()

Now the application crashes while saving the model after training.

The code snippet below.

auto rTrees = cv::ml::RTrees::create();

rTrees->setMaxDepth(100);

rTrees->setMinSampleCount(2);

rTrees->setTermCriteria(cv::TermCriteria(cv::TermCriteria::MAX_ITER, 100, 0));

rTrees->setActiveVarCount(0);

rTrees->setTruncatePrunedTree(true);

weightMatrix = cv::Mat(1, 2, CV_32F, { 1.0, 100.0 });
rTrees->setPriors(weightMatrix);

rTrees->train(sampleData, cv::ml::ROW_SAMPLE, sampleLabel);

rTrees->save(path);

The crash happens while I am trying to save the model.
DTreesImpl::writeTrainingPrams() is the call in which crash happens.

At times save works and most of the time, it fails.

Anybody has experienced this before or know whats going on in here?

Thanks in advance.