Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Get a probability out of svm->predict

I have trained an SVM with 6 classes.

I want to determine if my picture belongs to one of the classes and if yes to which class.

Currently I use this code

CvSVM *pSvm = new CvSVM();
pSvm->load("filename.xml", 0);
float pred = pSvm->predict(detectionImage);

The problem with this code is that no matter what picture I send to the svm it always return one out of my 6 classes. So to filter the pictures which belong to none of the classes I would need the probability that this picture belongs to my class.

Currently I only get the information that my picture belongs to class N (pred)

What I would like to get is: Picture belongs to class N with a probability of P

Then I could put a threshold on the probability to filter out my negatives.

If this is not working what is suggested way to filter out the negatives?