forked from sourenaKhanzadeh/face_detection_ml_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.asv
24 lines (15 loc) · 783 Bytes
/
main.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
run('../vlfeat-0.9.21/toolbox/vl_setup')
clf = Classifier;
pos_imageDir = 'train_pos_images';
[x_pos_train, pos_nImages] = clf.get_feature(pos_imageDir);
valid_pos_imageDir = 'validate_pos_images';
[x_pos_valid, valid_pos_nImages] = clf.get_feature(valid_pos_imageDir);
neg_imageDir = 'train_neg_images';
[x_neg_train, neg_nImages] = clf.get_feature(neg_imageDir);
valid_neg_imageDir = 'validate_neg_images';
[x_neg_valid, valid_neg_nImages] = clf.get_feature(valid_neg_imageDir);
save('class_feats.mat','x_pos_train','x_neg_train','pos_nImages','neg_nImages')
save('pos_n_feats.mat','x_pos_valid','x_neg_valid','valid_pos_nImages','valid_neg_nImages')
clf = Classifier;
[w, b, acc] = clf.train('pos_neg_feats.mat', 'pos_neg_valid_feats.mat');
save('my_svm.mat', 'w', 'b');