Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Why do I get segmentation fault on multiclass rtrees training?

$
0
0
I have data with 21 features and the number of classes is dependent of my goal. When I formulate my problem with 2 classes the following code works. But when I formulate my problem with 3 classes I get segmentation fault on the training method. The only thing that changes is the number of classes. This is my code: Mat trainSamples, trainClasses; float priors[] = { 1 , 1}; Mat var_type = Mat(21 + 1, 1, CV_8U ); var_type.setTo(Scalar(CV_VAR_NUMERICAL) ); // all inputs are numerical var_type.at(21, 0) = CV_VAR_CATEGORICAL; CvRTrees *rtrees; rtrees = new CvRTrees [1]; CvRTParams params( 25, // max_depth, 2000, // min_sample_count, 0, // regression_accuracy, false, // use_surrogates, 2, // max_categories, priors, // priors, false, // calc_var_importance, 4, // nactive_vars, 2000, // max_num_of_trees_in_the_forest, 0.000f, // forest_accuracy, CV_TERMCRIT_ITER | CV_TERMCRIT_EPS // termcrit_type ); load_feat(trainSamples, trainClasses, "data_model.csv"); //loading samples and corresponding class feat_standardization(trainSamples, &standard_feat); //samples standardization rtrees[0].train( trainSamples, CV_ROW_SAMPLE, trainClasses, Mat(), Mat(), var_type, Mat(), params ); Even when I change the max_categories parameter to 3 it does not work either. I hope that someone can enlighten me with this issue. Thank you.

Viewing all articles
Browse latest Browse all 19555

Trending Articles



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