mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Merge pull request #4174 from yangj1e:fix_svm_trainauto
This commit is contained in:
commit
4997f5dfe9
@ -1675,6 +1675,7 @@ public:
|
||||
Mat samples = data->getTrainSamples();
|
||||
Mat responses;
|
||||
bool is_classification = false;
|
||||
Mat class_labels0;
|
||||
int class_count = (int)class_labels.total();
|
||||
|
||||
if( svmType == C_SVC || svmType == NU_SVC )
|
||||
@ -1688,7 +1689,8 @@ public:
|
||||
setRangeVector(temp_class_labels, class_count);
|
||||
|
||||
// temporarily replace class labels with 0, 1, ..., NCLASSES-1
|
||||
Mat(temp_class_labels).copyTo(class_labels);
|
||||
class_labels0 = class_labels;
|
||||
class_labels = Mat(temp_class_labels).clone();
|
||||
}
|
||||
else
|
||||
responses = data->getTrainResponses();
|
||||
@ -1821,6 +1823,7 @@ public:
|
||||
}
|
||||
|
||||
params = best_params;
|
||||
class_labels = class_labels0;
|
||||
return do_train( samples, responses );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user