-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvm_com.m
23 lines (16 loc) · 878 Bytes
/
svm_com.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clear all;
BG=csvread('compressed/color/train/BG.csv');BG=reshape(BG',200*17120,1);
CG=csvread('compressed/color/train/CG.csv');CG=reshape(CG',200*17120,1);
TG=csvread('compressed/color/train/TG.csv');TG=reshape(TG',200*17120,1);
Human=csvread('compressed/color/train/Human.csv');Human=reshape(Human',200*17120,1);
Human(Human~=0)=1;Human(Human==0)=0;
X=cat(2,BG,CG,TG);
clear BG;clear CG;clear TG;
B = fitcsvm(X,Human,'KernelFunction','rbf','Standardize',true);
BG=csvread('compressed/color/test/BG.csv');BG=reshape(BG',100*17120,1);
CG=csvread('compressed/color/test/CG.csv');CG=reshape(CG',100*17120,1);
TG=csvread('compressed/color/test/TG.csv');TG=reshape(TG',100*17120,1);
Human_test=csvread('compressed/color/test/Human.csv');Human_test=reshape(Human_test',100*17120,1);
X_test=cat(2,BG,CG,TG);
Y_test=predict(B,X_test);
csvwrite('output/SVM_com.csv',Y_test);