简体   繁体   中英

svm classification of 2 classes with HOG feature

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); `

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM