forked from rbgirshick/voc-dpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.m
93 lines (78 loc) · 2.51 KB
/
compile.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
function compile(opt, verb, mex_file)
% Build MEX source code.
% All compiled binaries are placed in the bin/ directory.
%
% Windows users: Windows is not yet supported. You can likely
% get the code to compile with some modifications, but please
% do not email to ask for support.
%
% Arguments
% opt Compile with optimizations (default: on)
% verb Verbose output (default: off)
% AUTORIGHTS
% -------------------------------------------------------
% Copyright (C) 2011-2012 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 ispc
error('This code is not supported on Windows.');
end
startup;
if nargin < 1
opt = true;
end
if nargin < 2
verb = false;
end
% Start building the mex command
mexcmd = 'mex -outdir bin';
% Add verbosity if requested
if verb
mexcmd = [mexcmd ' -v'];
end
% Add optimizations if requested
if opt
mexcmd = [mexcmd ' -O'];
mexcmd = [mexcmd ' CXXOPTIMFLAGS="-O3 -DNDEBUG"'];
mexcmd = [mexcmd ' LDOPTIMFLAGS="-O3"'];
else
mexcmd = [mexcmd ' -g'];
end
% Turn all warnings on
mexcmd = [mexcmd ' CXXFLAGS="\$CXXFLAGS -Wall"'];
mexcmd = [mexcmd ' LDFLAGS="\$LDFLAGS -Wall"'];
if nargin < 3
% Build feature vector cache code
fv_compile(opt, verb);
% Build the star-cascade code
cascade_compile(opt, verb);
eval([mexcmd ' features/resize.cc']);
eval([mexcmd ' features/features.cc']);
eval([mexcmd ' gdetect/dt.cc']);
eval([mexcmd ' gdetect/bounded_dt.cc']);
eval([mexcmd ' gdetect/get_detection_trees.cc']);
eval([mexcmd ' gdetect/compute_overlap.cc']);
% Convolution routine
% Use one of the following depending on your setup
% (0) is fastest, (2) is slowest
% 0) multithreaded convolution using SSE
eval([mexcmd ' gdetect/fconvsse.cc -o fconv']);
% 1) multithreaded convolution
%eval([mexcmd ' gdetect/fconv_var_dim_MT.cc -o fconv']);
% 2) basic convolution, very compatible
%eval([mexcmd ' gdetect/fconv_var_dim.cc -o fconv']);
% Convolution routine that can handle feature dimenions other than 32
% 0) multithreaded convolution
eval([mexcmd ' gdetect/fconv_var_dim_MT.cc -o fconv_var_dim']);
% 1) single-threaded convolution
% eval([mexcmd ' gdetect/fconv_var_dim.cc -o fconv_var_dim']);
else
eval([mexcmd ' ' mex_file]);
end
rehash path;