pysaliency icon indicating copy to clipboard operation
pysaliency copied to clipboard

Error with AUC shuffled and NSS

Open junting opened this issue 9 years ago • 2 comments
trafficstars

Hello @matthias-k ,

I just find this error when I try to computed auc shuffled and nss. aucs = self.AUC_per_image(stimuli, fixations, nonfixations=nonfixations, verbose=verbose) File "/home/env/local/lib/python2.7/site-packages/pysaliency/saliency_map_models.py", line 253, in AUC_per_image xs *= stimuli.sizes[n][1]/widths[other_ns] TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

nss = my_model.NSSs(stimuli_salicon_val[0:50], fixations_salicon_val[fixations_salicon_val.n < 50],verbose=True) File "/home/env/local/lib/python2.7/site-packages/pysaliency/saliency_map_models.py", line 468, in NSSs _values -= mean TypeError: Cannot cast ufunc subtract output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'

I think that the problem can be solved by adding xs *= (stimuli.sizes[n][1]/widths[other_ns]).astype(xs.dtype) For the both cases. Is that correct?

Cheers, Junting

junting avatar Oct 19 '16 22:10 junting

There is another error with NSS: File "/home/env/local/lib/python2.7/site-packages/pysaliency/saliency_map_models.py", line 511, in NSSs _values /= std TypeError: ufunc 'true_divide' output (typecode 'd') could not be coerced to provided output parameter (typecode 'B') according to the casting rule ''same_kind''

junting avatar Oct 20 '16 09:10 junting

Hi @junting,

pysaliency expects both saliency maps and fixation positions to be floats. Probably I should enforce that somewhere, but I am not really sure were to do so. I try to avoid astype as it might create a lot of unneccessary copies. I could check the saliency map dtype in SaliencyMapModel.saliency_map.

matthias-k avatar Oct 20 '16 09:10 matthias-k