forked from votchallenge/toolkit-legacy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvot_environment.m
82 lines (56 loc) · 2.25 KB
/
vot_environment.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
function [sequences, experiments] = vot_environment()
try
% Attempts to load variables from the workspace namespace to save
% some time
sequences = evalin('base', 'sequences');
experiments = evalin('base', 'experiments');
% Are variables correts at a glance ...
cached = iscell(sequences) && iscell(experiments);
catch
cached = false;
end
configuration_file = fullfile(pwd(), 'configuration.m');
if ~exist(configuration_file, 'file')
error('Directory is probably not a VOT workspace. Please run vot_initialize first.');
end;
script_directory = fileparts(mfilename('fullpath'));
include_dirs = cellfun(@(x) fullfile(script_directory,x), {'', 'utilities', ...
'analysis', 'tracker', 'sequence', 'measures', 'experiment'}, 'UniformOutput', false);
addpath(include_dirs{:});
initialize_defaults;
set_global_variable('toolkit_path', fileparts(mfilename('fullpath')));
set_global_variable('indent', 0);
print_text('Initializing VOT environment ...');
global_configuration = get_global_variable('select_configuration', 'configuration');
try
environment_configuration = str2func(global_configuration);
environment_configuration();
catch e
if exist(global_configuration) ~= 2 %#ok<EXIST>
print_debug('Global configuration file does not exist. Using defaults.', ...
global_configuration);
else
error(e);
end;
end;
native_dir = fullfile(get_global_variable('toolkit_path'), 'mex');
mkpath(native_dir);
addpath(native_dir);
compile_all_native(native_dir);
if cached
print_debug('Skipping loading experiments and sequences');
else
experiment_stack = get_global_variable('stack', 'vot2013');
if exist(['stack_', experiment_stack]) ~= 2 %#ok<EXIST>
error('Experiment stack %s not available.', experiment_stack);
end;
stack_configuration = str2func(['stack_', experiment_stack]);
experiments = stack_configuration();
sequences_directory = fullfile(get_global_variable('directory'), 'sequences');
print_text('Loading sequences ...');
sequences = load_sequences(sequences_directory, ...
'list', get_global_variable('sequences', 'list.txt'));
if isempty(sequences)
error('No sequences available. Stopping.');
end;
end;