From 1a3f25cc285eaf26f251476520cad5958bc6270d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=BCmmmerer?= Date: Sat, 27 Jan 2024 12:46:52 +0100 Subject: [PATCH] Don't compute saliency maps in NSS if there are no fixations on the image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Kümmmerer --- pysaliency/saliency_map_models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pysaliency/saliency_map_models.py b/pysaliency/saliency_map_models.py index 23bebb9..eac0d1b 100644 --- a/pysaliency/saliency_map_models.py +++ b/pysaliency/saliency_map_models.py @@ -640,8 +640,10 @@ def CC(self, stimuli, other, verbose=False): def NSSs(self, stimuli, fixations, verbose=False): values = np.empty(len(fixations.x)) for n, s in enumerate(tqdm(stimuli, disable=not verbose)): - smap = self.saliency_map(s).copy() inds = fixations.n == n + if not inds.sum(): + continue + smap = self.saliency_map(s).copy() values[inds] = NSS(smap, fixations.x_int[inds], fixations.y_int[inds]) return values