Enforced DecisionFunction vector indexes to be saved on SVM save/load methods

pull/6345/head
Eduardo Arnold 9 years ago
parent ff0d115800
commit d046602ea4
  1. 6
      modules/ml/src/svm.cpp

@ -2092,7 +2092,7 @@ public:
<< "alpha" << "[:";
fs.writeRaw("d", (const uchar*)&df_alpha[df.ofs], sv_count*sizeof(df_alpha[0]));
fs << "]";
if( class_count > 2 )
if( class_count >= 2 )
{
fs << "index" << "[:";
fs.writeRaw("i", (const uchar*)&df_index[df.ofs], sv_count*sizeof(df_index[0]));
@ -2234,11 +2234,11 @@ public:
df_index.resize(ofs + sv_count);
df_alpha.resize(ofs + sv_count);
dfi["alpha"].readRaw("d", (uchar*)&df_alpha[ofs], sv_count*sizeof(df_alpha[0]));
if( class_count > 2 )
if( class_count >= 2 )
dfi["index"].readRaw("i", (uchar*)&df_index[ofs], sv_count*sizeof(df_index[0]));
decision_func.push_back(df);
}
if( class_count <= 2 )
if( class_count < 2 )
setRangeVector(df_index, sv_total);
if( (int)fn["optimize_linear"] != 0 )
optimize_linear_svm();

Loading…
Cancel
Save