lishuoxi
lishuoxi

Reputation: 1

Why is there only one support vector in OpenCV's SVM

I am using libsvm to train a SVM with hog features. The model file has n support vectors. But when I try to use it in OpenCV's SVM I found that there is only one vector in OpenCV's model. How does OpenCV do it??

Upvotes: 0

Views: 997

Answers (2)

Afterbunny
Afterbunny

Reputation: 81

Here is the explanation from Learning OpenCV3: In the case of linear SVM, all the support vectors for each decision plane can be compressed into a single vector that will basically describe the separating hyperplane.

Upvotes: 0

etarion
etarion

Reputation: 17159

I guess libsvm stores support vectors, whereas opencv just uses a weight vector to store the hyperplane (one vector + one scalar suffices to describe a plane) - you can get there from the decision function using the support vectors by swapping sum and scalar product.

Upvotes: 1

Related Questions