-
Notifications
You must be signed in to change notification settings - Fork 133
/
setup.m
71 lines (65 loc) · 2.46 KB
/
setup.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
function setup(doCompile, matconvnetOpts)
% SETUP Setup paths, dependencies, etc.
%
% doCompile:: false
% Set to true to compile the libraries
% matconvnetOpts:: struct('enableGpu',false)
% Options for vl_compilenn
if nargin==0,
doCompile = false;
elseif nargin<2,
matconvnetOpts = struct('enableGpu', false);
end
if doCompile && gpuDeviceCount()==0 ...
&& isfield(matconvnetOpts,'enableGpu') && matconvnetOpts.enableGpu,
fprintf('No supported gpu detected! ');
return;
end
addpath(genpath('dataset'));
addpath(genpath('utils'));
% -------------------------------------------------------------------------
% liblinear
% -------------------------------------------------------------------------
if doCompile,
if ispc
cd('dependencies/liblinear-1.96/');
% change to vcvars32 for 32-bit platforms
!vcvars64 & nmake /f Makefile.win clean & nmake /f Makefile.win lib
cd('../../');
else
!make -C dependencies/liblinear-1.96/ clean
!make -C dependencies/liblinear-1.96/
end
run dependencies/liblinear-1.96/matlab/make.m
end
addpath('dependencies/liblinear-1.96/matlab');
% -------------------------------------------------------------------------
% vlfeat
% -------------------------------------------------------------------------
if doCompile,
if ispc
cd('dependencies/vlfeat/');
% change to vcvars32 for 32-bit platforms
% if there is a crash here, you need to explicitly change
% the paths and parameters in vlfeat's Makefile.mak
% also remove "-f $(MEXOPT)" from Makefile.mak for latest VS
% versions.
!vcvars64 & nmake /f Makefile.mak clean & nmake /f Makefile.mak
cd('../../');
else
!make -C dependencies/vlfeat/ clean
!make -C dependencies/vlfeat/
end
end
run dependencies/vlfeat/toolbox/vl_setup.m
% -------------------------------------------------------------------------
% matconvnet
% -------------------------------------------------------------------------
if doCompile,
run dependencies/matconvnet/matlab/vl_setupnn.m
cd dependencies/matconvnet
vl_compilenn(matconvnetOpts);
cd ../..
end
run dependencies/matconvnet/matlab/vl_setupnn.m
addpath('dependencies/matconvnet/examples/imagenet');