-
Notifications
You must be signed in to change notification settings - Fork 4
/
perfPlot.m
198 lines (152 loc) · 7.29 KB
/
perfPlot.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
clear
close all;
clc
addpath('./util');
attPath = '.\anno\att\'; % The folder that contains the annotation files for sequence attributes
attName={'illumination variation' 'out-of-plane rotation' 'scale variation' 'occlusion' 'deformation' 'motion blur' 'fast motion' 'in-plane rotation' 'out of view' 'background clutter' 'low resolution'};
attFigName={'illumination_variations' 'out-of-plane_rotation' 'scale_variations' 'occlusions' 'deformation' 'blur' 'abrupt_motion' 'in-plane_rotation' 'out-of-view' 'background_clutter' 'low_resolution'};
plotDrawStyleAll={ struct('color',[1,0,0],'lineStyle','-'),...
struct('color',[0,1,0],'lineStyle','-'),...
struct('color',[0,0,1],'lineStyle','-'),...
struct('color',[0,0,0],'lineStyle','-'),...% struct('color',[1,1,0],'lineStyle','-'),...%yellow
struct('color',[1,0,1],'lineStyle','-'),...%pink
struct('color',[0,1,1],'lineStyle','-'),...
struct('color',[0.5,0.5,0.5],'lineStyle','-'),...%gray-25%
struct('color',[136,0,21]/255,'lineStyle','-'),...%dark red
struct('color',[255,127,39]/255,'lineStyle','-'),...%orange
struct('color',[0,162,232]/255,'lineStyle','-'),...%Turquoise
struct('color',[163,73,164]/255,'lineStyle','-'),...%purple %%%%%%%%%%%%%%%%%%%%
struct('color',[1,0,0],'lineStyle','--'),...
struct('color',[0,1,0],'lineStyle','--'),...
struct('color',[0,0,1],'lineStyle','--'),...
struct('color',[0,0,0],'lineStyle','--'),...% struct('color',[1,1,0],'lineStyle','--'),...%yellow
struct('color',[1,0,1],'lineStyle','--'),...%pink
struct('color',[0,1,1],'lineStyle','--'),...
struct('color',[0.5,0.5,0.5],'lineStyle','--'),...%gray-25%
struct('color',[136,0,21]/255,'lineStyle','--'),...%dark red
struct('color',[255,127,39]/255,'lineStyle','--'),...%orange
struct('color',[0,162,232]/255,'lineStyle','--'),...%Turquoise
struct('color',[163,73,164]/255,'lineStyle','--'),...%purple %%%%%%%%%%%%%%%%%%%
struct('color',[1,0,0],'lineStyle','-.'),...
struct('color',[0,1,0],'lineStyle','-.'),...
struct('color',[0,0,1],'lineStyle','-.'),...
struct('color',[0,0,0],'lineStyle','-.'),...% struct('color',[1,1,0],'lineStyle',':'),...%yellow
struct('color',[1,0,1],'lineStyle','-.'),...%pink
struct('color',[0,1,1],'lineStyle','-.'),...
struct('color',[0.5,0.5,0.5],'lineStyle','-.'),...%gray-25%
struct('color',[136,0,21]/255,'lineStyle','-.'),...%dark red
struct('color',[255,127,39]/255,'lineStyle','-.'),...%orange
struct('color',[0,162,232]/255,'lineStyle','-.'),...%Turquoise
struct('color',[163,73,164]/255,'lineStyle','-.'),...%purple
};
plotDrawStyle10={ struct('color',[1,0,0],'lineStyle','-'),...
struct('color',[0,1,0],'lineStyle','--'),...
struct('color',[0,0,1],'lineStyle',':'),...
struct('color',[0,0,0],'lineStyle','-'),...% struct('color',[1,1,0],'lineStyle','-'),...%yellow
struct('color',[1,0,1],'lineStyle','--'),...%pink
struct('color',[0,1,1],'lineStyle',':'),...
struct('color',[0.5,0.5,0.5],'lineStyle','-'),...%gray-25%
struct('color',[136,0,21]/255,'lineStyle','--'),...%dark red
struct('color',[255,127,39]/255,'lineStyle',':'),...%orange
struct('color',[0,162,232]/255,'lineStyle','-'),...%Turquoise
};
seqs=configSeqs;
trackers=configTrackers;
% seqs = seqs(1:10);
% trackers = trackers(1:10);
numSeq=length(seqs);
numTrk=length(trackers);
nameTrkAll=cell(numTrk,1);
for idxTrk=1:numTrk
t = trackers{idxTrk};
nameTrkAll{idxTrk}=t.namePaper;
end
nameSeqAll=cell(numSeq,1);
numAllSeq=zeros(numSeq,1);
att=[];
for idxSeq=1:numSeq
s = seqs{idxSeq};
nameSeqAll{idxSeq}=s.name;
s.len = s.endFrame - s.startFrame + 1;
numAllSeq(idxSeq) = s.len;
att(idxSeq,:)=load([attPath s.name '.txt']);
end
attNum = size(att,2);
figPath = '.\figs\overall\';
perfMatPath = '.\perfMat\overall\';
if ~exist(figPath,'dir')
mkdir(figPath);
end
metricTypeSet = {'error', 'overlap'};
evalTypeSet = {'SRE', 'TRE', 'OPE'};
rankingType = 'AUC';%AUC, threshod
rankNum = 10;%number of plots to show
if rankNum == 10
plotDrawStyle=plotDrawStyle10;
else
plotDrawStyle=plotDrawStyleAll;
end
thresholdSetOverlap = 0:0.05:1;
thresholdSetError = 0:50;
for i=1:length(metricTypeSet)
metricType = metricTypeSet{i};%error,overlap
switch metricType
case 'overlap'
thresholdSet = thresholdSetOverlap;
rankIdx = 11;
xLabelName = 'Overlap threshold';
yLabelName = 'Success rate';
case 'error'
thresholdSet = thresholdSetError;
rankIdx = 21;
xLabelName = 'Location error threshold';
yLabelName = 'Precision';
end
if strcmp(metricType,'error')&strcmp(rankingType,'AUC')
continue;
end
tNum = length(thresholdSet);
for j=1:length(evalTypeSet)
evalType = evalTypeSet{j};%SRE, TRE, OPE
plotType = [metricType '_' evalType];
switch metricType
case 'overlap'
titleName = ['Success plots of ' evalType];
case 'error'
titleName = ['Precision plots of ' evalType];
end
dataName = [perfMatPath 'aveSuccessRatePlot_' num2str(numTrk) 'alg_' plotType '.mat'];
% If the performance Mat file, dataName, does not exist, it will call
% genPerfMat to generate the file.
if ~exist(dataName)
genPerfMat(seqs, trackers, evalType, nameTrkAll, perfMatPath);
end
load(dataName);
numTrk = size(aveSuccessRatePlot,1);
if rankNum > numTrk | rankNum <0
rankNum = numTrk;
end
figName= [figPath 'quality_plot_' plotType '_' rankingType];
idxSeqSet = 1:length(seqs);
% draw and save the overall performance plot
plotDrawSave(numTrk,plotDrawStyle,aveSuccessRatePlot,idxSeqSet,rankNum,rankingType,rankIdx,nameTrkAll,thresholdSet,titleName, xLabelName,yLabelName,figName,metricType);
% draw and save the performance plot for each attribute
attTrld = 0;
for attIdx=1:attNum
idxSeqSet=find(att(:,attIdx)>attTrld);
if length(idxSeqSet) < 2
continue;
end
disp([attName{attIdx} ' ' num2str(length(idxSeqSet))])
figName=[figPath attFigName{attIdx} '_' plotType '_' rankingType];
titleName = ['Plots of ' evalType ': ' attName{attIdx} ' (' num2str(length(idxSeqSet)) ')'];
switch metricType
case 'overlap'
titleName = ['Success plots of ' evalType ' - ' attName{attIdx} ' (' num2str(length(idxSeqSet)) ')'];
case 'error'
titleName = ['Precision plots of ' evalType ' - ' attName{attIdx} ' (' num2str(length(idxSeqSet)) ')'];
end
plotDrawSave(numTrk,plotDrawStyle,aveSuccessRatePlot,idxSeqSet,rankNum,rankingType,rankIdx,nameTrkAll,thresholdSet,titleName, xLabelName,yLabelName,figName,metricType);
end
end
end