Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

doubt in multiclass svm

Hello all, i'm doing classification using one to all multiclass svm. my data set have 10 classes like running, walking ,biking riding, waving, walking etc. and each class have 20 videos. my doubt in what should be label for each class. should i have to take labels like---

 float labels[10] = {0, 1, 2, 3,.......10};
 Mat labelsMat(10, 1, CV_32FC1, labels);

and training data for each class

float trainingData1[4] [n]= { feature1, feature2, feature3, feature4};
Mat trainingDataMat1(4, n, CV_32FC1, trainingData1);

then create svm for each class such as

Ptr<SVM> svm1 = SVM::create();

svm1->train(trainingDataMat1, ROW_SAMPLE, labelsMat);

here each svm should be trained with same labelsMat or i have to define different labels for each class?

and at the time testing i have to apply predict function with each svm1...svmN like

float response1 = svm1->predict(sampleMat); . . . . float responseK = svmN->predict(sampleMat);

then accuracy is calculated?? please clear my doubts. Thanks