fixed SVM
authorMaria Dimashova <no@email>
Mon, 9 Aug 2010 15:43:06 +0000 (15:43 +0000)
committerMaria Dimashova <no@email>
Mon, 9 Aug 2010 15:43:06 +0000 (15:43 +0000)
modules/ml/src/inner_functions.cpp
modules/ml/src/svm.cpp

index e653407..495edd4 100644 (file)
@@ -676,7 +676,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
     if( r_type != CV_32FC1 && r_type != CV_32SC1 )
         CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" );
 
-    r_step = responses->step ? responses->step / CV_ELEM_SIZE(responses->type) : 1;
+    r_step = responses->rows == 1 ? 1 : responses->step / CV_ELEM_SIZE(responses->type);
 
     if( sample_idx )
     {
index 5544d3d..8c32655 100644 (file)
@@ -1330,6 +1330,8 @@ bool CvSVM::do_train( int svm_type, int sample_count, int var_count, const float
     const int sample_size = var_count*sizeof(samples[0][0]);
     int i, j, k;
 
+    cvClearMemStorage( storage );
+
     if( svm_type == ONE_CLASS || svm_type == EPS_SVR || svm_type == NU_SVR )
     {
         int sv_count = 0;