forked from sourenaKhanzadeh/face_detection_ml_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetect_class_faces.m
46 lines (36 loc) · 1.49 KB
/
detect_class_faces.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
run('../vlfeat-0.9.21/toolbox/vl_setup')
lambda = 0.00005;
scale = 1;
downsample = 0.9;
cellSize = 3;
marg = 11;
dim = 36;
thresh = 1;
params = containers.Map(...
{'feat_cellSize', 'feat_n_cell', 'lambda', 'scale',...
'downsample', 'cellSize', 'marg', 'factor', 'thresh', 'ov_factor',...
'top'},...
{3, 12, lambda, scale, downsample, cellSize, marg, dim, thresh, 0.01, 200});
clf = Classifier(params);
% 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('class_valid_feats.mat','x_pos_valid','x_neg_valid','valid_pos_nImages','valid_neg_nImages')
%
% [w, b, acc] = clf.train('class_feats.mat', 'class_valid_feats.mat');
%
% save('class_svm.mat', 'w', 'b');
imageDir = 'final_test';
% [bboxes, confidences, image_names] = clf.detect(imageDir, false, 'class_svm.mat', true);
[bboxes, confidences, image_names] = clf.detect(imageDir, false, 'my_svm.mat', true);