forked from kevinlisun/clothes_recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search_featureweight.m
57 lines (45 loc) · 1.33 KB
/
search_featureweight.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
47
48
49
50
51
52
53
54
55
56
% options_weight = [10 30 60 90];
% parpool(4)
% parfor i=1:length(options_weight)
% best_weight = [];
% best_result = 0;
% % for j=1:length(options_weight)
% % for k=1:length(options_weight)
% j=2;
% k=3;
% for m=1:length(options_weight)
% weight_feature= [options_weight(i) options_weight(j) options_weight(k) options_weight(m) ];
% [collecton_video, Label] = b1_clothes_classification(weight_feature);
% Lc = evaluate_lgsr(collecton_video, Label);
% weight_feature
% if Lc > best_result
% best_result = Lc;
% best_weight = weight_feature;
% disp('New result');
% disp(best_result)
% disp(best_weight)
% end
% end
% % end
% % end
% end
best_result1 = 0;
while best_result1 < 0.64
labels = unique(Label);
train_percent = 0.6;
test_percent = 1 - train_percent;
vector_train = [];
for i=1:length(labels)
n= sum(Label== labels(i));
ids = find(Label== labels(i));
p = randperm(n,ceil(n*train_percent));
vector_train = [vector_train ; sort(ids(p))];
end
% vector_train, vector_test
vector_test = ones( size(Label) );
vector_test(vector_train) = 0;;
vector_test = find(vector_test== 1);
weight_feature= [15 40 120 10]; % 0.6
[collecton_video, Label] = b1_clothes_classification(weight_feature, 13, 42);
[best_result1, best_result2] = evaluate_lgsr(collecton_video, Label, vector_train, vector_test, 'euclidean');
end