forked from Cloud-CV/object-proposals
-
Notifications
You must be signed in to change notification settings - Fork 1
/
compile.m
358 lines (318 loc) · 11.1 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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
global configjson
% add current directory as the parent directory
parDir = pwd;
% adding evaluation metrics into path
% add jsonlib to path and load the config file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% pDollarToolBox compiling %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
pDollarToolBoxPath=[pwd '/dependencies/pDollarToolbox'];
addpath(genpath(pDollarToolBoxPath));
toolboxCompile;
catch exc
fprintf('Piotr Dollar tool box compilation failed\n');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%compiling structured edge detector %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
cd dependencies/structuredEdges/release/private;
mex edgesDetectMex.cpp
mex edgesNmsMex.cpp
mex spDetectMex.cpp
mex edgeBoxesMex.cpp
cd(parDir)
fprintf('Compilation of Structured edge detector sucessfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of structured edge detector failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%compiling vlfeat%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
vlDir = [parDir '/dependencies/vlfeat-0.9.16/toolbox'];
cd(vlDir);
vl_setup;
cd(parDir);
catch exc
fprintf('Compilation of vlfeat failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%% compilation of edge boxes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of Edge Boxes started\n ');
cd edgeBoxes/releaseV3/private/;
mex edgesDetectMex.cpp
mex edgesNmsMex.cpp
mex spDetectMex.cpp
mex edgeBoxesMex.cpp
cd(parDir)
fprintf('Compilation of Edge Boxes sucessfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Edge Boxes failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% building MCG and installation%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of MCG started\n ');
mcg_path = [pwd '/mcg/MCG-pre-trained'];
addpath(genpath([pwd '/mcg/MCG-pre-trained']));
%set root_dir for mcg
mcgRootDir = mcg_path;
boostPath='/opt/local/include/';
%build and install
mcg_build(parDir, mcgRootDir, boostPath);
%mcg_install(mcgRootDir);
fprintf('Compilation of MCG sucessfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of MCG failed\n ');
fprintf(exc.message);
fprintf('***************************');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%
%% building Endres %%%%
%%%%%%%%%%%%%%%%%%%%%%%
%noothing to do
try
fprintf('Compilation of Endres started\n ');
endres_path = [pwd '/endres/proposals'];
%configjson.endres.endrespath = endres_path;
%addpath(genpath(endres_path));
cd(endres_path);
endres_compile;
cd(parDir);
fprintf('Compilation of Endres sucessfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Endres failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% building rantalankila %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of Rantalankila Segments started\n ');
vlfeatpath = [ pwd '/dependencies/vlfeat-0.9.16/' ];
run(fullfile(vlfeatpath, 'toolbox/vl_setup'));
cd([pwd '/dependencies/GCMex/']);
GCMex_compile;
cd(parDir);
fprintf('Compilation of Rantalankila Segments successfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Rantalankila failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%
%% building rahtu %%
%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of Rahtu started\n ');
addpath(genpath([pwd '/rahtu']));
rahtuPath = [pwd '/rahtu/rahtuObjectness'];
compileObjectnessMex(parDir, rahtuPath);
fprintf('Compilation of Rahtu successfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Rahtu failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% building randomizedPrims%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of Randomized Prims started\n ');
rpPath = [pwd, '/randomizedPrims/rp-master'];
addpath(genpath(rpPath))
setupRandomizedPrim(rpPath);
fprintf('Compilation of Randomized Prims successfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Randomized Prims failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%
%% building objectness %%
%%%%%%%%%%%%%%%%%%%%%%%%%
%nothing to do
try
fprintf('Compiling Objectness \n');
%addpath(genpath([pwd, '/objectness-release-v2.2']));
%configjson.objectness.objectnesspath = [pwd, '/objectness-release-v2.2'];
%params=defaultParams(configjson.objectness.objectnesspath);
%configjson.objectness.params=params;
cd objectness-release-v2.2/MEX;
mex slidingWindowComputeScore.c;
mex scoreSamplingMex.c;
mex NMS_sampling.c;
mex nms4d.c;
mex computeScoreContrast.c;
mex computeIntegralHistogramMex.c;
cd(parDir);
fprintf('Compiling Objectness succesfully finished \n');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Objectness failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% building selective_search %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compiling Selective Search \n');
mex 'selective_search/Dependencies/anigaussm/anigauss_mex.c' 'selective_search/Dependencies/anigaussm/anigauss.c' -output anigauss -outdir 'selective_search'
mex 'selective_search/Dependencies/mexCountWordsIndex.cpp' -outdir 'selective_search'
mex 'selective_search/Dependencies/FelzenSegment/mexFelzenSegmentIndex.cpp' -output mexFelzenSegmentIndex -outdir 'selective_search'
fprintf('Compiling Selective Search succesfully finished \n');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Selective Search failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%
%% building rigor %%
%%%%%%%%%%%%%%%%%%%%
fprintf('Compiling Rigor \n');
tbb_incl_opt = '';
tbb_lib_opt = '';
boost_incl_opt = '';
boost_lib_opt = '';
extra_opts = '';
% set directories and options
if ispc
% if windows
tbb_dir = 'D:/tbb42';
tbb_incl_dir = fullfile(tbb_dir, 'include');
tbb_libs = fullfile(tbb_dir, 'lib/intel64/vc12');
boost_dir = 'D:/boost/1.55.0/VC/11.0';
boost_libs = fullfile(boost_dir, 'stage/lib');
tbb_incl_opt = ['-I', tbb_incl_dir];
tbb_lib_opt = ['-L', tbb_libs];
boost_incl_opt = ['-I', boost_dir];
boost_lib_opt = ['-L', boost_libs];
elseif ismac
% if mac
else
% if unix/linux
fprintf('linux var set for rigor \n');
boost_libs = '/usr/local/lib';
boost_lib_opt = ['-L', boost_libs];
extra_opts = '-lrt';
end
rigor_path = [pwd '/rigor/rigor_src'];
addpath(genpath(rigor_path));
addpath([pwd '/rigor/API']);
% make
% addpath(genpath([pwd '/dependencies']));
% find locations of files
code_root_dir = fullfile(fileparts(which(mfilename)), 'rigor/rigor_src');
utils_dir = fullfile(code_root_dir, 'utils');
extern_dir = fullfile(code_root_dir, 'extern_src');
boykov_dir = fullfile(code_root_dir, 'boykov_maxflow');
try
fprintf('eval statements\n');
% mex code
eval(sprintf('mex -O %s/intens_pixel_diff_mex.c -output %s/intens_pixel_diff_mex', utils_dir, utils_dir));
eval(sprintf('mex -O %s/prctile_feats.cpp -output %s/prctile_feats', utils_dir, utils_dir));
eval(sprintf('mex -O %s/region_centroids_mex.cpp -output %s/region_centroids_mex', utils_dir, utils_dir));
eval(sprintf('mex -O %s/superpix_regionprops.cpp -output %s/superpix_regionprops', utils_dir, utils_dir));
eval(sprintf('mex -O %s/sp_conncomp_mex.cpp %s -output %s/sp_conncomp_mex', utils_dir, boost_incl_opt, utils_dir));
eval(sprintf(['mex -O ', ...
'%s/segm_overlap_mex.cpp ', ...
'%s/overlap.cpp ', ...
'-output %s/segm_overlap_mex'], utils_dir, utils_dir, utils_dir));
eval(sprintf('mex -O %s/convert_masks.cpp -output %s/convert_masks', utils_dir, utils_dir));
eval(sprintf(['mex -O ', ...
'%s/overlap_over_threshold.cpp ', ...
'CFLAGS="\\$CFLAGS -fopenmp" LDFLAGS="\\$LDFLAGS -fopenmp" ', ...
'-output %s/overlap_over_threshold'], utils_dir, utils_dir));
eval(sprintf('mex -O %s/para_pseudoflow/hoch_pseudo_par.c -output %s/para_pseudoflow/hoch_pseudo_par', extern_dir, extern_dir));
eval(sprintf(['mex -O ', ...
'%s/bk_dynamicgraphs_mex.cpp ', ...
'%s/dynamicgraphs/bk_nodynamic.cpp ', ...
'%s/dynamicgraphs/bk_kohli.cpp ', ...
'%s/dynamicgraphs/bk_multiseeddynamic.cpp ', ...
'%s/dynamicgraphs/bk_utils.cpp %s %s %s -ltbb ', ...
'LDFLAGS="\\$LDFLAGS %s -lboost_system-mt -lboost_timer-mt %s" ', ...
'-output %s/bk_dynamicgraphs_mex;'], ...
boykov_dir, boykov_dir, boykov_dir, boykov_dir, boykov_dir, ...
boost_incl_opt, tbb_incl_opt, tbb_lib_opt, boost_lib_opt, ...
extra_opts, boykov_dir));
fprintf('Compiling RIGOR succesfully finished \n');
catch exc
fprintf('Compilation of RIGOR failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Building Geodesic Object Proposals
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of Geodesic Object Proposals started\n ');
gopPath = [pwd, '/gop_1.3/matlab'];
addpath(genpath(gopPath));
cd(gopPath);
compile();
%%system(sprintf('cp %s/gop_mex.mexa64.compiled %s/gop_mex.mexa64',pwd,pwd));
cd(parDir);
fprintf('Compilation of Geodesic Object Proposals successfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of Geodesic Object Proposals failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
%%%%%%%%%%%%%%%%%%
%% Building LPO %%
%%%%%%%%%%%%%%%%%%
try
fprintf('Compilation of LPO started\n ');
lpoPath = [pwd, '/lpo/matlab'];
addpath(genpath(lpoPath));
cd(lpoPath);
compile();
%%system(sprintf('cp %s/gop_mex.mexa64.compiled %s/gop_mex.mexa64',pwd,pwd));
cd(parDir);
fprintf('Compilation of LPO successfully finished\n ');
fprintf('***************************\n');
catch exc
fprintf('Compilation of LPO failed\n ');
fprintf(exc.message);
fprintf('***************************\n');
cd(parDir);
end
fprintf('******Compiling complete.*********\n')