-
Notifications
You must be signed in to change notification settings - Fork 11
/
myGTprediction.m
93 lines (78 loc) · 1.83 KB
/
myGTprediction.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
function [out] = myGTprediction(data)
out = [];
% data.objectFiles contains data on previous frame pedestrians
% data.detections + data.id contains current frame pedestrians info
% let's start by dividing the occluded objects by the still present ones
POF = objectFile.filterOccludedObjects(data.objectFiles);
OOF = objectFile.getOccludedObjects(data.objectFiles);
% get some number
n_POF = length(POF);
n_OOF = length(OOF);
n_DET = length(data.id);
out = zeros(n_POF + n_OOF + n_DET);
% BLOCK A
for i = 1 : n_POF
for j = 1 : n_DET
if POF{i}.realID == data.id(j)
out(i, j) = 1;
break;
end
end
end
% BLOCK C
for i = 1 : n_POF
if sum(out(i, :)) == 0
out(i, n_DET + n_OOF + i) = 1;
end
end
% BLOCK D
for i = 1 : n_OOF
for j = 1 : n_DET
if OOF{i}.realID == data.id(j)
out(n_POF + i, j) = 1;
break;
end
end
end
% BLOCK E
for i = 1 : n_OOF
if sum(out(n_POF + i, :)) == 0
out(n_POF + i, n_DET + i) = 1;
end
end
% BLOCK G
for j = 1 : n_DET
if sum(out(:, j)) == 0
out(n_POF + n_OOF + j, j) = 1;
end
end
% BLOCK H
for j = 1 : n_OOF
if sum(out(:, n_DET + j)) == 0
for i = 1 : n_DET
if sum(out(n_POF + n_OOF + i, :)) == 0
out(n_POF + n_OOF + i, n_DET + j) = 1;
break;
end
end
end
end
% BLOCK I
for j = 1 : n_POF
if sum(out(:, n_DET + n_OOF + j)) == 0
for i = 1 : n_DET
if sum(out(n_POF + n_OOF + i, :)) == 0
out(n_POF + n_OOF + i, n_DET + n_OOF + j) = 1;
break;
end
end
end
end
% CHECK THE CONSTRUCTION OF BLOCKS E, H AND I
if ismember(0, sum(out, 2)) || ismember(2, sum(out, 2))
disp 2;
end
if ismember(0, sum(out, 1)) || ismember(2, sum(out, 1))
disp 1;
end
end