0
votes

I need to classify the HOG features of a car occupied and empty space . the training data is having a feature length of 56 X 144 and test data feature length of 28 X 144 . training data contains both positive and negative samples . how can i classify using these data in MATLAB using SVM classifier . This is the syntax i came to know while training.

"Mdl = fitcsvm(X,Y)

But i didn't get any idea from this.. where i need to give training data and test data in this syntax ?

Please help me ..

code is

tr1=trainOf; % occupied image HOG FEATURES

tr2=trainVf; % empty image HOG features

X=[tr1;tr2]; % whole training data

Y=xlsread('CLASSLABEL.xlsx'); % class labels for training data

svmStruct=svmtrain(X,Y);

classes=svmclassify(svmStruct,testf,'showplot',true); `
1
By common convention, X is the training data features and Y is the training data labels/class. I think this tutorial covers almost everything you need regarding SVM classifier mathworks.com/help/stats/fitcsvm.html. As for extracting HOG features, this example should help mathworks.com/help/vision/ref/extracthogfeatures.html - Yohanes Gultom
Thank you for the help...but i went through these tutorials to train and classify... and now the classification is having around 50% error.. its miss classifying .. how can i correct it sir - Anju K.V.
Unfortunately no one can help you with such a limited information. It could be because of the implementation or the dataset itself or other cause. So I'd suggest you to post your code (and if possible, link to the dataset in .mat) so others can help you better - Yohanes Gultom
sir, i have edited my question to add the code which i have wrote.. i don't know how to post the dataset here :( - Anju K.V.

1 Answers

1
votes

I recommend you to use another SVM toolbox,libsvm. The link is as follow: http://www.csie.ntu.edu.tw/~cjlin/libsvm/

After adding it to the path of matlab, you can train and use you model like this:

model=svmtrain(train_label,train_feature,'-c 1 -g 0.07 -h 0'); 
% the parameters can be modified
[label, accuracy, probablity]=svmpredict(test_label,test_feaure,model);

Hope this will help you!