-
Notifications
You must be signed in to change notification settings - Fork 1
/
generateTSVMResultsSim.m
executable file
·64 lines (34 loc) · 1.39 KB
/
generateTSVMResultsSim.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
57
58
59
60
61
62
63
64
% generate TSVM Results Sim
function generateTSVMResultsSim(video_name,method_num)
if (method_num == 1)
tsvm_path = fullfile('svmlin_TSVM_Method1/');
elseif (method_num == 2)
tsvm_path = fullfile('svmlin_TSVM_Method2/');
end
file_names = fullfile(tsvm_path, strcat ( video_name, '.names'));
fid_names = fopen(file_names);
names_info = textscan(fid_names, '%s');
file_outputs = fullfile(tsvm_path, strcat ( video_name, '.output.outputs'));
fid_outputs = fopen(file_outputs);
outputs_info = textscan(fid_outputs, '%f');
file_train_labels = fullfile(tsvm_path, strcat ( video_name, '_trainlabelssvm'));
fid_train_labels = fopen(file_train_labels);
train_labels_info = textscan(fid_train_labels, '%d');
file_sim = fullfile(tsvm_path, strcat ( video_name, '.sim'));
fid_sim = fopen(file_sim,'w+');
%names_info{1}{1}, .. names_info{1}{2}
img_index = 1;
for i=1:length(train_labels_info{1,1})
if (train_labels_info{1,1}(i) == -1)
continue;
end
cur_img_name = names_info{1,1}(img_index);
cur_outputVal = (outputs_info{1,1}(i));
if (cur_outputVal>=0)
cur_row = sprintf('%s\n', num2str(cell2mat(cur_img_name)));
fprintf(fid_sim, cur_row);
end
img_index = img_index +1;
end
fclose(fid_sim);
end