-
Notifications
You must be signed in to change notification settings - Fork 5
/
organize_LabelMe.m
executable file
·40 lines (29 loc) · 1002 Bytes
/
organize_LabelMe.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
function [] = organize_LabelMe()
%% separates the visual words and annotations into categories
classnames = {'Coast', 'Forest', 'Highway', 'Insidecity', 'Mountain', 'Opencountry', 'Street', 'Tallbuilding'};
N = max(size(classnames));
V = 200;
GlobalAttrList = load('GlobalAttrList.mat');
maxvtopics = size(GlobalAttrList.GlobalAttrList,2);
for i=1:N
filename1 = [classnames{i} '_LabelMe_annotations.mat'];
filename2 = [classnames{i} '_LabelMe_Vwords.mat'];
filename3 = [classnames{i} '_LabelMe.mat'];
A = load(filename1);
B = load(filename2);
B = B.A;
filename = A.FileName;
M = max(size(filename));
annotations = zeros(M,maxvtopics);
vwordsindex = B.vwordsindex;
vwordscount = B.vwordscount;
liblindata = [];
for j=1:M
tempmat = zeros(1,V);
tempmat(vwordsindex{j}) = vwordscount{j};
liblindata = [liblindata; sparse(tempmat)];
annotations(j, A.AttrIndex{j}) = 1;
end
save(filename3, 'filename', 'annotations', 'vwordsindex', 'vwordscount', 'liblindata');
end
end