forked from ignaciorlando/fundus-vessel-segmentation-tbme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_evaluate_existing_model.m
68 lines (55 loc) · 2.01 KB
/
script_evaluate_existing_model.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
warning('off','all');
% data sets to segment
datasets_names = {...
'DIARETDB1\train' ...
'DIARETDB1\test' ...
'e-ophtha' ...
'MESSIDOR' ...
};
% scale to downsample (it is expected that all the images in the data sets
% has approximately the same resolution)
scale_to_downsample = [ ...
0.74011, ...
0.74011, ...
0.96324, ...
0.81875, ...
];
[ret, hostname] = system('hostname');
hostname = strtrim(lower(hostname));
% Lab computer
if strcmp(hostname, 'orlando-pc')
% Root dir where the data sets are located
rootDatasets = 'C:\_diabetic_retinopathy';
% Root folder where the results are going to be stored
rootResults = 'C:\_diabetic_retinopathy\segmentations';
% Model location
modelLocation = 'C:\Users\USUARIO\Dropbox\RetinalImaging\Writing\drscreening2016paper\data\segmentation-model';
end
thereAreLabelsInTheTestData = 0 * zeros(size(datasets_names));
load(fullfile(modelLocation, 'model.mat'));
load(fullfile(modelLocation, 'config.mat'));
% For each of the data sets
for i = 1 : length(datasets_names)
% Set the test path
config.test_data_path = fullfile(rootDatasets, datasets_names{i});
config.features.saveFeatures = 1;
% Set the results path
if (~strcmp(rootResults, 'training'));
if strcmp(config.crfVersion, 'up')
resultsPath = fullfile(rootResults, datasets_names{i});
else
resultsPath = fullfile(rootResults, datasets_names{i});
end
if (~exist(resultsPath,'dir'))
config.output_path = resultsPath;
mkdir(resultsPath);
end
end
config.resultsPath = resultsPath;
% Assign downsample factor
config.downsample_factor = scale_to_downsample(i);
% Determine if there are test data
config.thereAreLabelsInTheTestData = thereAreLabelsInTheTestData(i);
% Run vessel segmentation!
runVesselSegmentationUsingExistingModel(config, model)
end