forked from HengLan/LaSOT_Evaluation_Toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tracker_performance_evaluation.m
171 lines (142 loc) · 6.04 KB
/
run_tracker_performance_evaluation.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
% Tracker performance evaluation tool for LaSOT
% 07/19/2018 by Heng Fan
clc; clear; close all;
addpath('./utils/');
addpath('./sequence_evaluation_config/');
tmp_mat_path = './tmp_mat/'; % path to save temporary results
path_anno = './annos/'; % path to annotations
path_att = './annos/att/'; % path to attribute
rp_all = './tracking_results/'; % path to tracking results
save_fig_path = './res_fig/'; % path to result figures
save_fig_suf = 'eps'; % suffix of figures, 'png' or 'eps'
att_name = {'Illumination Variation', 'Partial Occlusion', 'Deformation', ...
'Motion Blur', 'Camera Motion', 'Rotation', 'Background Clutter', ...
'Viewpoint Change', 'Scale Variation', 'Full Occlusion', 'Fast Motion', ...
'Out-of-View', 'Low Resolution', 'Aspect Ration Change'};
att_fig_name = {'IV', 'POC', 'DEF', 'MB', 'CM', 'ROT', 'BC', ...
'VC', 'SV', 'FOC', 'FM', 'OV', 'LR', 'ARC'};
% 'all' --- evaluation with the whole benchmark
% 'test_set' --- evaluation with training subset
evaluation_dataset_type = 'all';
% use normalization or not
norm_dst = false;
trackers = config_tracker();
sequences = config_sequence(evaluation_dataset_type);
plot_style = config_plot_style();
num_seq = numel(sequences);
num_tracker = numel(trackers);
% load tracker info
name_tracker_all = cell(num_tracker, 1);
for i = 1:num_tracker
name_tracker_all{i} = trackers{i}.name;
end
% load sequence info
name_seq_all = cell(num_seq, 1);
for i = 1:num_seq
name_seq_all{i} = sequences{i};
seq_att = dlmread(fullfile(path_att, [sequences{i} '.txt']));
if i == 1
att_all = zeros(num_seq, numel(seq_att));
end
att_all(i, :) = seq_att;
end
% parameters for evaluation
metric_type_set = {'error', 'overlap'};
eval_type = 'OPE';
% ranking_type = 'AUC';
ranking_type = 'threshold'; % change it to 'AUC' for success plots
rank_num = 35;
threshold_set_error = 0:50;
if norm_dst
threshold_set_error = threshold_set_error / 100;
end
threshold_set_overlap = 0:0.05:1;
for i = 1:numel(metric_type_set)
% error (for distance plots) or overlap (for success plots)
metric_type = metric_type_set{i};
switch metric_type
case 'error'
threshold_set = threshold_set_error;
rank_idx = 21;
x_label_name = 'Location error threshold';
y_label_name = 'Precision';
case 'overlap'
threshold_set = threshold_set_overlap;
rank_idx = 11;
x_label_name = 'Overlap threshold';
y_label_name = 'Success rate';
end
% if strcmp(metric_type, 'error') && strcmp(ranking_type, 'AUC') % for ranking_type = 'AUC'
if strcmp(metric_type, 'overlap') && strcmp(ranking_type, 'threshold') % for ranking_type = 'threshold'
continue;
end
t_num = numel(threshold_set);
% we only use OPE for evaluation
plot_type = [metric_type '_' eval_type];
switch metric_type
case 'error'
title_name = ['Precision plots of ' eval_type];
if norm_dst
title_name = ['Normalized ' title_name];
end
if strcmp(evaluation_dataset_type, 'all')
title_name = [title_name ' on LaSOT'];
else
title_name = [title_name ' on LaSOT Testing Set'];
end
case 'overlap'
title_name = ['Success plots of ' eval_type];
if strcmp(evaluation_dataset_type, 'all')
title_name = [title_name ' on LaSOT'];
else
title_name = [title_name ' on LaSOT Testing Set'];
end
end
dataName = [tmp_mat_path 'aveSuccessRatePlot_' num2str(num_tracker) ...
'alg_' plot_type '.mat'];
% evaluate tracker performance
if ~exist(dataName, 'file')
eval_tracker(sequences, trackers, eval_type, name_tracker_all, ...
tmp_mat_path, path_anno, rp_all, norm_dst);
end
% plot performance
load(dataName);
num_tracker = size(ave_success_rate_plot, 1);
if rank_num > num_tracker || rank_num <0
rank_num = num_tracker;
end
fig_name= [plot_type '_' ranking_type];
idx_seq_set = 1:numel(sequences);
% draw and save the overall performance plot
plot_draw_save(num_tracker, plot_style, ave_success_rate_plot, ...
idx_seq_set, rank_num, ranking_type, rank_idx, ...
name_tracker_all, threshold_set, title_name, ...
x_label_name, y_label_name, fig_name, save_fig_path, ...
save_fig_suf);
% draw and save the per-attribute performance plot
att_trld = 0;
att_num = size(att_all, 2);
for att_idx = 1:att_num % for each attribute
idx_seq_set = find(att_all(:, att_idx) > att_trld);
if length(idx_seq_set) < 2
continue;
end
disp([att_name{att_idx} ' ' num2str(length(idx_seq_set))]);
fig_name = [att_fig_name{att_idx} '_' plot_type '_' ranking_type];
title_name = ['Plots of ' eval_type ': ' att_name{att_idx} ' (' num2str(length(idx_seq_set)) ')'];
switch metric_type
case 'overlap'
title_name = ['Success plots of ' eval_type ' - ' att_name{att_idx} ' (' num2str(length(idx_seq_set)) ')'];
case 'error'
title_name = ['Precision plots of ' eval_type ' - ' att_name{att_idx} ' (' num2str(length(idx_seq_set)) ')'];
if norm_dst
title_name = ['Normalized ' title_name];
end
end
plot_draw_save(num_tracker, plot_style, ave_success_rate_plot, ...
idx_seq_set, rank_num, ranking_type, rank_idx, ...
name_tracker_all, threshold_set, title_name, ...
x_label_name, y_label_name, fig_name, save_fig_path, ...
save_fig_suf);
end
end