I am trying to classify 7 parts of face(eye,nose,skin etc) by extracting color and position features. But the ouput is amazing. It is giving me just one class. I was thinking if their is somethng wrong with my code. by the way this is training data code
Mat Cols(28539,97,CV_32F); //containing training data
Right now I'm not able to tell there is somethong wrong with your code. I should check my code first.
But a couple of considerations.
First, did you scale your data? Maybe the svm is correct, while the problem is in your features scale.
Second, did you learn svm parameters? Did some cross validation? If you feed your svm with the same features as training, do you have a correct output class? Maybe svm parameters are just wrong.
Third, maybe your features are not separable. Maybe you should use other more discriminant features, or try another svm kernel.
Last, I see that you are using opencv. Why don't you use opencv svmclassifier class? As I remember, the only advantage of using libsvm when using opencv is that opencv won't let you specify a custom kernel. If that's not your case, use opencv svm, which is a wrapper of libsvm, but is lessa error-prone...
Problem with OpenCV SVM it gives probability prediction just for binary class. I ave seven classes so cant use that. No I have not scale the data. No cross validation is used. I am changing the things according to your advises then I will tell you. thanks for your help Michele Fornaciari.
returnDFVal – Specifies a type of the return value. If true and the problem is 2-class classification then the method returns the decision function value that is signed distance to the margin, else the function returns a class label (classification) or estimated function value (regression).
This is used to get probability estimate in Opencv. but The function works for binary classification problems only. I need probability estimates for seven classes which is not in opencv. But libSVM proivdes this by
Michele Fornaciari this is 2.9 not an old one. Even in 3.0 there is no option for predicting probabaility for multiple classes. Can you plz tell me how to scale data in C++/Opencv using Libsvm. I did not found any fucntion in svm.h for scalling data. Can you help me how to scale data for libsvm. I think this is main problem with my data. becaues in my data there are values between 0 and 5000 which must be scaled i think. Please help me out if you can.
Jeffrey M Girard can you help me a have train dataset 400 images and 10 class ı want to my test dataset which has 192 images ı want to use multi class classification with libsvm.
Sezer ali Aksu if will suggest you to use alglib if you are using c++ for your simulation. Libsvm wasted alot of time from me and results for alglib and libsvm is nearly same. But you will save a lot of time due to complex nature and calculations of libsvm.
@Khali Khan. Did you refer to Alglib here (http://www.alglib.net/dataanalysis/)? So far I can not find SVM C++ algorithm there! I am also doing a multiclass-SVM Classification and I am interested in generating class probabilities. So far I have been able to use dlib C++ library (http://dlib.net/ml.html) but I am stuck on how to generate the probabilities, here is my code (https://sourceforge.net/p/dclib/discussion/442517/thread/c34fe256/) . I will really appreciate any assistance/advice going forward. Thank you.