svm multiclass classifier predicts same class for all objects
I have 14 classes of images - these are sampled from a kinect video of 14 objects. Using HOG for feature extraction and SVM for classification. There are 20 training samples for each class. I have also tried KAZE feature extractor and Random Forest, but the same class is predicted for all. what am I doing wrong?
These are the parameters used for SVM
////create and train the svm
//Ptr<ml::SVM> svm = SVM::create();
//svm->setKernel(SVM::RBF);
//svm->setType(SVM::C_SVC);
////Ptr<ml::ParamGrid> nogrid = ml::ParamGrid::create(0, 0, 0);//no need nu, coeff0 or p
//auto td = TrainData::create(mat, ROW_SAMPLE, labels);
//ParamGrid Cgrid = SVM::getDefaultGrid(SVM::C);
//ParamGrid pGrid = SVM::getDefaultGrid(SVM::P);
//ParamGrid gammaGrid = SVM::getDefaultGrid(SVM::GAMMA);
//ParamGrid nuGrid = SVM::getDefaultGrid(0);
//ParamGrid coeffGrid = SVM::getDefaultGrid(SVM::COEF);
//ParamGrid degreeGrid = SVM::getDefaultGrid(0);
//svm->trainAuto(td,30,Cgrid,gammaGrid,pGrid,nuGrid,coeffGrid,degreeGrid,true);
Thanks for any help
sadly, it's unclear now, what is actually used, and what is commented away ;(
there may also be errors in assembling your train data / label, and we can't see it.
ridicullously low. you need 100x the data
please look up on (binary !!) features, metrics / distance formulas. most likely your data does not make sense with the given ml algo.
I'm getting stuck with the same problem.The model allways predicts the same class. Did you find an answer for that?