-
Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathMOT_cross_validation.m
65 lines (55 loc) · 2.06 KB
/
MOT_cross_validation.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
% --------------------------------------------------------
% MDP Tracking
% Copyright (c) 2015 CVGL Stanford
% Licensed under The MIT License [see LICENSE for details]
% Written by Yu Xiang
% --------------------------------------------------------
%
% cross_validation on the MOT benchmark
function MOT_cross_validation
% set is_train to 0 if testing trained trackers only
is_train = 1;
opt = globals();
mot2d_train_seqs = {'TUD-Stadtmitte', 'TUD-Campus', 'PETS09-S2L1', ...
'ETH-Bahnhof', 'ETH-Sunnyday', 'ETH-Pedcross2', 'ADL-Rundle-6', ...
'ADL-Rundle-8', 'KITTI-13', 'KITTI-17', 'Venice-2'};
% training and testing pairs
seq_idx_train = {{1}, {4}, {7}, {9}};
seq_idx_test = {{2}, {5, 6}, {8, 11}, {10}};
seq_set_test = 'train';
N = numel(seq_idx_train);
% for each training-testing pair
for i = 1:N
% training
idx_train = seq_idx_train{i};
if is_train
% number of training sequences
num = numel(idx_train);
tracker = [];
% online training
for j = 1:num
fprintf('Online training on sequence: %s\n', mot2d_train_seqs{idx_train{j}});
tracker = MDP_train(idx_train{j}, tracker);
end
fprintf('%d training examples after online training\n', size(tracker.f_occluded, 1));
else
% load tracker from file
filename = sprintf('%s/%s_tracker.mat', opt.results, mot2d_train_seqs{idx_train{end}});
object = load(filename);
tracker = object.tracker;
fprintf('load tracker from file %s\n', filename);
end
% testing
idx_test = seq_idx_test{i};
% number of testing sequences
num = numel(idx_test);
for j = 1:num
fprintf('Testing on sequence: %s\n', mot2d_train_seqs{idx_test{j}});
MDP_test(idx_test{j}, seq_set_test, tracker);
end
end
% evaluation for all test sequences
benchmark_dir = fullfile(opt.mot, opt.mot2d, seq_set_test, filesep);
seqs = {'TUD-Campus', 'ETH-Sunnyday', 'ETH-Pedcross2', ...
'ADL-Rundle-8', 'Venice-2', 'KITTI-17'};
evaluateTracking(seqs, opt.results, benchmark_dir);