-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.nfs00000000b001cc0700000068
55 lines (44 loc) · 1.63 KB
/
.nfs00000000b001cc0700000068
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
function [] = vlav()
vlad_vocabulary = load('64_VLAD_vocab.mat');
vlad_vocabulary = double(vlad_vocabulary.centers)';
vlad_kdtree = vl_kdtreebuild(vocabulary);
INPUT_PATH = '../PROCESSED_DATA/';
d = dir(INPUT_PATH);
isub = [d(:).isdir];
main_folds = {d(isub).name}';
main_folds(ismember(main_folds,{'.','..'})) = [];
for i=1:size(main_folds,1)
MAIN_FOLDER_PATH = strcat(INPUT_PATH,main_folds{i},'/')
% now list all of the folders within this folder
d1 = dir(MAIN_FOLDER_PATH);
isub = [d1(:).isdir];
sub_folder_names = {d1(isub).name}';
sub_folder_names(ismember(sub_folder_names,{'.','..'})) = [];
for j=1:size(sub_folder_names,1)
SUB_FOLDER_PATH = strcat(MAIN_FOLDER_PATH,sub_folder_names{j},'/');
d = dir(strcat(SUB_FOLDER_PATH));
isub = [d(:).isdir];
segment_names = {d(isub).name}';
segment_names(ismember(segment_names,{'.','..'})) = [];
for k=1:size(segment_names,1)
RAND_PROJ_PATH = strcat(SUB_FOLDER_PATH,segment_names{k},'/rand_proj_vlad/');
VLAD_PATH = strcat(SUB_FOLDER_PATH,segment_names{k},'/vlads/')
d = dir(strcat(VLAD_PATH,'/','*.mat'));
isub = ~[d(:).isdir];
vlad_names = {d(isub).name}';
vlad_names(ismember(vlad_names,{'.','..'})) = [];
avg_vlad = zeros(8192,1);
for l=1:size(vlad_names,1)
file_vlad_path = strcat(VLAD_PATH,sprintf('%05d',l),'_vlad.mat');
v = load(file_vlad_path);
v = v.vlad;
avg_vlad = avg_vlad+v;
file_rand_proj_path = strcat(RAND_PROJ_PATH,sprintf('%05d',l),'_vladproj.mat')
rpv = load(file_rand_proj_path);
rpv = rpv.projected_vlad;
end
avg_vlad = avg_vlad./size(vlad_names,1);
end
end
end
end