Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OPencv SVM predict probability

Tags:

opencv

svm

I am developing a image-classification project using BOW model and SVM. I want to find out the SVMs predict probability but there is no such function in opencv svm. Is there any way to do this? I want to find out the predict probability in n-class SVM.

like image 279
Shailesh Srivastava Avatar asked May 28 '13 02:05

Shailesh Srivastava


People also ask

How does SVM predict probability?

One standard way to obtain a “probability” out of an SVM is to use Platt scaling, which is available in many decent SVM implementations. In the binary case, the probabilities are calibrated using Platt scaling: logistic regression on the SVM's scores, fit by an additional cross-validation on the training data.

Does SVM give probabilities?

SVMs do not directly provide probability estimates, these are calculated using an expensive five-fold cross-validation (see Scores and probabilities, below).


1 Answers

No you can't do this with CvSVM. OpenCV's SVM implementation is based on a very old version of libsvm. Download the latest version of libsvm and use it instead. Of course you will have to write a wrapper to convert data formats. See http://www.csie.ntu.edu.tw/~cjlin/libsvm/

like image 160
Bull Avatar answered Nov 01 '22 09:11

Bull