Commit 1e15758c630f7fc0ef4f5efe349ca4fe796cf495
1 parent
2478d1bb
Attribute bug fixes
Showing
2 changed files
with
5 additions
and
3 deletions
openbr/plugins/filter.cpp
openbr/plugins/svm.cpp
| ... | ... | @@ -74,7 +74,7 @@ static void trainSVM(SVM &svm, Mat data, Mat lab, int kernel, int type, float C, |
| 74 | 74 | svm.train_auto(data, lab, Mat(), Mat(), params, 5); |
| 75 | 75 | } catch (...) { |
| 76 | 76 | qWarning("Some classes do not contain sufficient examples or are not discriminative enough for accurate SVM classification."); |
| 77 | - svm.train(data, lab); | |
| 77 | + svm.train(data, lab, Mat(), Mat(), params); | |
| 78 | 78 | } |
| 79 | 79 | } else { |
| 80 | 80 | params.C = C; |
| ... | ... | @@ -161,7 +161,8 @@ private: |
| 161 | 161 | dst.m().at<float>(0, 0) = prediction; |
| 162 | 162 | // positive values ==> first class |
| 163 | 163 | // negative values ==> second class |
| 164 | - prediction = prediction > 0 ? 0 : 1; | |
| 164 | + if (type != EPS_SVR && type != NU_SVR) | |
| 165 | + prediction = prediction > 0 ? 0 : 1; | |
| 165 | 166 | } |
| 166 | 167 | if (type == EPS_SVR || type == NU_SVR) { |
| 167 | 168 | dst.file.set(outputVariable, prediction); | ... | ... |