-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcreateDetectionsFromGT_OCCLUSIONS.m
51 lines (40 loc) · 1.5 KB
/
createDetectionsFromGT_OCCLUSIONS.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
%% INITIALIZE
clc; clear;
%% PARAMETERS
baseFolder = 'D:\lab\TBD-evaluation';
datasetName = 'AVG-TownCentre';
N_range = 0 : 0.2 : 1;
L_range = 0 : 0.2 : 1;
% number of run to account for randomness
d = 5;
%% LOAD DATA
addpath(genpath('utils'));
data = dlmread(fullfile(baseFolder, datasetName, '\gt\gt.txt'));
frames = unique(data(:, 1));
n_frames = length(frames);
IDs = unique(data(:,2));
n_people = length(IDs);
%% MAIN LOOP - ONE FOR EACH FILE
for n = N_range
for l = L_range
for run = 1 : d
% number and IDs of occluded targets
num_occ = floor(n_people * n);
occ_index = randperm(n_people, num_occ);
occ_id = IDs(occ_index);
% set BB size to zero when occluded
final_data = data;
for i = 1 : length(occ_id)
% retrieve data for track and occlude it
T_occ = data(data(:,2) == occ_id(i), [1 3 4 5 6]);
T_new = occlude_traj(T_occ, l);
% update track with occlusion info
final_data(data(:,2) == occ_id(i), [1 3 4 5 6]) = T_new;
end
% delete occluded pieces of trajectories
final_data(final_data(:, 5) == 0, :) = [];
% write text file
dlmwrite(fullfile(datasetName, 'occlusions_data', sprintf('%s_N%.2f_L%.2f_%02d.txt', datasetName, n, l, run)), final_data, 'delimiter', ' ');
end
end
end