-
Notifications
You must be signed in to change notification settings - Fork 309
/
process.m
52 lines (48 loc) · 1.43 KB
/
process.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
function [ds, bs] = process(im, model, thresh)
% Detect objects that score above a threshold.
% [ds, bs] = process(im, model, thresh)
%
% If the threshold is not included we use the one in the model.
% This should lead to high-recall but low precision.
%
% Return values
% ds Clipped detection windows
% bs Boxes for all placed filters
%
% Arguments
% im Image
% model Object model
% thresh Detection threshold
% AUTORIGHTS
% -------------------------------------------------------
% Copyright (C) 2011-2012 Ross Girshick
% Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick
%
% This file is part of the voc-releaseX code
% (http://people.cs.uchicago.edu/~rbg/latent/)
% and is available under the terms of an MIT-like license
% provided in COPYING. Please retain this notice and
% COPYING if you use this file (or a portion of it) in
% your project.
% -------------------------------------------------------
if nargin < 3
thresh = model.thresh
end
tic;
[ds, bs] = imgdetect(im, model, thresh);
toc;
if ~isempty(ds)
if model.type == model_types.MixStar
if isfield(model, 'bboxpred')
bboxpred = model.bboxpred;
[ds, bs] = clipboxes(im, ds, bs);
[ds, bs] = bboxpred_get(bboxpred, ds, reduceboxes(model, bs));
else
warning('no bounding box predictor found');
end
end
[ds, bs] = clipboxes(im, ds, bs);
I = nms(ds, 0.5);
ds = ds(I,:);
bs = bs(I,:);
end