Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

RTrees training fails due to Assertion in calcDir

Hi,

I'm trying to train a random descision forest for regression but it fails due to an assertion in tree.cpp:1190

OpenCV Error: Assertion failed ((int)_sleft.size() < n && (int)_sright.size() < n) in cv::ml::DTreesImpl::calcDir, file C:\builds\master_PackSlave-win64-vc12-shared\opencv\modules\ml\src\tree.cpp, line 1190
exception caught: C:\builds\master_PackSlave-win64-vc12-shared\opencv\modules\ml\src\tree.cpp:1190: error: (-215) (int)_sleft.size() < n && (int)_sright.size() < n in function cv::ml::DTreesImpl::calcDir

With smaller training sets the forest seems to work fine, but as soon as I use > 20000 features it fails during training. My current settings are:

Ptr<RTrees> rtrees = RTrees::create();
rtrees->setMaxDepth(10);
rtrees->setMinSampleCount(10);
rtrees->setRegressionAccuracy(0.1f);
rtrees->setUseSurrogates(false);
rtrees->setMaxCategories(16);
rtrees->setPriors(Mat());
rtrees->setCalculateVarImportance(false);
rtrees->setActiveVarCount(1);
rtrees->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER,100, 0));

Has anyone else experienced this problem or knows the reason for the error?

Thanks!