-
Notifications
You must be signed in to change notification settings - Fork 4
/
genPerfMat.m
114 lines (86 loc) · 3.55 KB
/
genPerfMat.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
function genPerfMat(seqs, trackers, evalType, nameTrkAll, perfMatPath)
pathAnno = './anno/';
numTrk = length(trackers);
thresholdSetOverlap = 0:0.05:1;
thresholdSetError = 0:50;
switch evalType
case 'SRE'
rpAll=['.\results\results_SRE_CVPR13\'];
case {'TRE', 'OPE'}
rpAll=['.\results\results_TRE_CVPR13\'];
end
for idxSeq=1:length(seqs)
s = seqs{idxSeq};
s.len = s.endFrame - s.startFrame + 1;
s.s_frames = cell(s.len,1);
nz = strcat('%0',num2str(s.nz),'d'); %number of zeros in the name of image
for i=1:s.len
image_no = s.startFrame + (i-1);
id = sprintf(nz,image_no);
s.s_frames{i} = strcat(s.path,id,'.',s.ext);
end
rect_anno = dlmread([pathAnno s.name '.txt']);
numSeg = 20;
[subSeqs, subAnno]=splitSeqTRE(s,numSeg,rect_anno);
nameAll=[];
for idxTrk=1:numTrk
t = trackers{idxTrk};
% load([rpAll s.name '_' t.name '.mat'], 'results','coverage','errCenter');
load([rpAll s.name '_' t.name '.mat'])
disp([s.name ' ' t.name]);
aveCoverageAll=[];
aveErrCenterAll=[];
errCvgAccAvgAll = 0;
errCntAccAvgAll = 0;
errCoverageAll = 0;
errCenterAll = 0;
lenALL = 0;
switch evalType
case 'SRE'
idxNum = length(results);
anno=subAnno{1};
case 'TRE'
idxNum = length(results);
case 'OPE'
idxNum = 1;
anno=subAnno{1};
end
successNumOverlap = zeros(idxNum,length(thresholdSetOverlap));
successNumErr = zeros(idxNum,length(thresholdSetError));
for idx = 1:idxNum
res = results{idx};
if strcmp(evalType, 'TRE')
anno=subAnno{idx};
end
len = size(anno,1);
if isempty(res.res)
break;
end
if ~isfield(res,'type')&&isfield(res,'transformType')
res.type = res.transformType;
res.res = res.res';
end
[aveCoverage, aveErrCenter, errCoverage, errCenter] = calcSeqErrRobust(res, anno);
for tIdx=1:length(thresholdSetOverlap)
successNumOverlap(idx,tIdx) = sum(errCoverage >thresholdSetOverlap(tIdx));
end
for tIdx=1:length(thresholdSetError)
successNumErr(idx,tIdx) = sum(errCenter <= thresholdSetError(tIdx));
end
lenALL = lenALL + len;
end
if strcmp(evalType, 'OPE')
aveSuccessRatePlot(idxTrk, idxSeq,:) = successNumOverlap/(lenALL+eps);
aveSuccessRatePlotErr(idxTrk, idxSeq,:) = successNumErr/(lenALL+eps);
else
aveSuccessRatePlot(idxTrk, idxSeq,:) = sum(successNumOverlap)/(lenALL+eps);
aveSuccessRatePlotErr(idxTrk, idxSeq,:) = sum(successNumErr)/(lenALL+eps);
end
end
end
%
dataName1=[perfMatPath 'aveSuccessRatePlot_' num2str(numTrk) 'alg_overlap_' evalType '.mat'];
save(dataName1,'aveSuccessRatePlot','nameTrkAll');
dataName2=[perfMatPath 'aveSuccessRatePlot_' num2str(numTrk) 'alg_error_' evalType '.mat'];
aveSuccessRatePlot = aveSuccessRatePlotErr;
save(dataName2,'aveSuccessRatePlot','nameTrkAll');