forked from ShaoqingRen/faster_rcnn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactive_caffe_mex.m
28 lines (24 loc) · 951 Bytes
/
active_caffe_mex.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
function active_caffe_mex(gpu_id, caffe_version)
% active_caffe_mex(gpu_id, caffe_version)
% --------------------------------------------------------
% Faster R-CNN
% Copyright (c) 2015, Shaoqing Ren
% Licensed under The MIT License [see LICENSE for details]
% --------------------------------------------------------
% set gpu in matlab
gpuDevice(gpu_id);
if ~exist('caffe_version', 'var') || isempty(caffe_version)
caffe_version = 'caffe';
end
cur_dir = pwd;
caffe_dir = fullfile(pwd, 'external', 'caffe', 'matlab', caffe_version);
if ~exist(caffe_dir, 'dir')
warning('Specified caffe folder (%s) is not exist, change to default one (%s)', ...
caffe_dir, fullfile(pwd, 'external', 'caffe', 'matlab'));
caffe_dir = fullfile(pwd, 'external', 'caffe', 'matlab');
end
addpath(genpath(caffe_dir));
cd(caffe_dir);
caffe.set_device(gpu_id-1);
cd(cur_dir);
end