-
Notifications
You must be signed in to change notification settings - Fork 4
/
compute_IOU.m
53 lines (35 loc) · 1.27 KB
/
compute_IOU.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
clear;
clc;
gtpath = 'Camouflage_project/CAMO-COCO-V.1.0';
datasets = {'Camouflage'};
phases = {'Test'};
%==========================================================================
output_path = 'Results';
if(~exist(output_path, 'dir'))
mkdir(output_path);
end
for k=1:length(phases)
phase = phases{k};
input_path = {};
algs = {};
input_path = [input_path; 'Camouflage_project/Results'];
algs = [algs; ['ANet_' phase]];
matrix_IOU = zeros(length(algs), length(datasets));
matrix_IOU_cell = cell(length(algs), length(datasets));
for i=1:length(datasets)
dataset = datasets{i};
for j=1:length(algs)
alg = algs{j};
fprintf('IOU: %s - %s\n', dataset, alg);
gt_dir = [gtpath '/' dataset '/' phase '/GT/' ];
%sal_dir = [input_path{j} '/' dataset '/' phase '/' ];
sal_dir = [input_path{j}];
iou = CallIOU(sal_dir, gt_dir, 0);
iou_mean = nanmean(iou)
matrix_IOU(j,i) = iou_mean;
matrix_IOU_cell{j,i} = iou;
end
end
save([output_path '/' 'matrix_IOU_' phase '.mat'], 'matrix_IOU', 'matrix_IOU_cell', 'algs', 'datasets');
end
%==========================================================================