Import trained SVM from scikit-learn to OpenCV

﹥>﹥吖頭↗ 提交于 2019-12-05 10:25:40

You don't need epsilon and iterations anymore, those are used in the training optimization problem. You can set them to your favorite number or ignore them.

Porting the support vectors may require some fiddling, as indexing may be different between and . The XML in your example has no sparse format for example.

As for the other parameters:

  • rho should correspond to intercept_, but you may need to change sign.
  • scikit's dual_coef_ corresponds to sv_coef in standard models (which is alpha_i*y_i).

If complains about the values you provide for alpha when porting, use absolute values of 's dual_coef_ (e.g. all positive). These are the true alpha values of an SVM model.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!