-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpascal_test.m
33 lines (29 loc) · 1.02 KB
/
pascal_test.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
function [boxes] = pascal_test(cls, model, testset, suffix)
% [boxes] = pascal_test(cls, model, testset, suffix)
% Compute bounding boxes in a test set.
% boxes are bounding boxes from root placements
globals;
pascal_init;
ids = textread(sprintf(VOCopts.imgsetpath, testset), '%s');
% run detector in each image
try
load([cachedir cls '_boxes_' testset '_' suffix]);
catch
opts = VOCopts;
parfor i = 1:length(ids);
fprintf('%s: testing: %s %s, %d/%d\n', cls, testset, '2007', ...
i, length(ids));
im = color(imread(sprintf(opts.imgpath, ids{i})));
[feat, scales] = featpyramid(im, model.sbin, model.interval);
b = detect(feat, scales, model, model.thresh, false, []);
if ~isempty(b)
b1 = b(:,[1 2 3 4 end]);
b1 = clipboxes(zeros(model.sbin*size(feat{1+model.interval},1), model.sbin*size(feat{1+model.interval},2)), b1);
boxes{i} = nms(b1, 0.5);
else
boxes{i} = [];
end
showboxes(im, boxes{i});
end
save([cachedir cls '_boxes_' testset '_' suffix], 'boxes');
end