From 7e3c1d3744b26b9b89994d9d40d4d230771ecd9a Mon Sep 17 00:00:00 2001 From: dberga Date: Fri, 27 May 2016 15:10:44 +0200 Subject: [PATCH 1/2] added IG metric --- code_forMetrics/IG.m | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 code_forMetrics/IG.m diff --git a/code_forMetrics/IG.m b/code_forMetrics/IG.m new file mode 100644 index 0000000..449c3c5 --- /dev/null +++ b/code_forMetrics/IG.m @@ -0,0 +1,31 @@ +% created: David Berga, May 2016 + +% This finds the Information Gain between a saliency map and the ground +% truth fixation map. +% It is a non-symmetric measure of the information gain when saliencyMap +% is used to estimate fixationMap by substracting a baseline map, +% which is the averaged the ground truth fixation maps of all other images + + +function [score,map] = IG(saliencyMap, fixationMap, baselineMap) +% saliencyMap is the saliency map +% fixationMap is the binary human fixation map +% baselineMap is the saliency mean from other human fixation maps + +map1 = im2double(imresize(saliencyMap, size(fixationMap))); +map2 = im2double(fixationMap); +map3 = im2double(imresize(baselineMap, size(fixationMap))); + +% make sure map1 and map3 sum to 1 +if any(map1(:)) + map1 = map1/sum(map1(:)); +end + +if any(map3(:)) + map3 = map3/sum(map3(:)); +end + +% compute IG +score = mean(mean(map2 .* (log2(eps + map1) - log2(eps+map3)))); +map = map2 .* (log2(eps + map1) - log2(eps+map3)); + From ab4936d3922ccfed4591cf5863dd6c3836210600 Mon Sep 17 00:00:00 2001 From: dberga Date: Thu, 16 Feb 2017 14:58:39 +0100 Subject: [PATCH 2/2] Update IG.m --- code_forMetrics/IG.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_forMetrics/IG.m b/code_forMetrics/IG.m index 449c3c5..179f7eb 100644 --- a/code_forMetrics/IG.m +++ b/code_forMetrics/IG.m @@ -26,6 +26,6 @@ end % compute IG -score = mean(mean(map2 .* (log2(eps + map1) - log2(eps+map3)))); +score = mean(nonzeros(map2 .* (log2(eps + map1) - log2(eps+map3)))); map = map2 .* (log2(eps + map1) - log2(eps+map3));