From d38f69427538173ba7df15118e53d4d94a83efd7 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Thu, 12 Jul 2012 12:29:50 +0000 Subject: [PATCH] fixed CvBoost in mll if no tree can be trained. --- modules/ml/src/boost.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/ml/src/boost.cpp b/modules/ml/src/boost.cpp index d7206274b..e7066e1b9 100644 --- a/modules/ml/src/boost.cpp +++ b/modules/ml/src/boost.cpp @@ -910,7 +910,7 @@ CvBoost::CvBoost() void CvBoost::prune( CvSlice slice ) { - if( weak ) + if( weak && weak->total > 0 ) { CvSeqReader reader; int i, count = cvSliceLength( slice, weak ); @@ -1076,11 +1076,15 @@ CvBoost::train( const CvMat* _train_data, int _tflag, break; } - get_active_vars(); // recompute active_vars* maps and condensed_idx's in the splits. - data->is_classifier = true; - ok = true; - - data->free_train_data(); + if(weak->total > 0) + { + get_active_vars(); // recompute active_vars* maps and condensed_idx's in the splits. + data->is_classifier = true; + data->free_train_data(); + ok = true; + } + else + clear(); __END__;