Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange issue in pysaliency-matlab cooperation #15

Open
sqroprzemo opened this issue Jul 27, 2020 · 4 comments
Open

strange issue in pysaliency-matlab cooperation #15

sqroprzemo opened this issue Jul 27, 2020 · 4 comments

Comments

@sqroprzemo
Copy link

sqroprzemo commented Jul 27, 2020

I have a strange issue in running pysaliency. It reports notoriously 'file not found' error whenever the code employs the Matlab.
Following Quickstart
1.
It happened when downloading MIT1003 dataset
magically, somehow when in debug I called pysaliency.get_mit1003 interactively then it downloaded, so now i got the fixations and stimuli (so now I can get center bias for deepgaze at least)

but just in next step it happens again
2.

aim = pysaliency.AIM(location=model_location)
Python reports:
_File "C:\Users\squro.conda\envs\DS1\lib\site-packages\scipy\io\matlab\mio.py", line 45, in open_file
return open(file_like, mode), True
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\squro\AppData\Local\Temp\tmpcaf9knjd\saliency_map.mat'

whereas Matlab console shows:
_Reading Image.
Error using imread>get_full_filename (line 567)
File "C:\Users\squro\AppData\Local\Temp\tmp4j41rzxk\stimulus.png" does not exist.

Error in imread (line 374)
fullname = get_full_filename(filename);

Error in AIM (line 142)
inimage = (imresize(im2double((imread(filename))),resizesize));

Error in AIM_wrapper (line 5)
saliency_map = AIM(filename, 1.0, convolve, filters);
ERROR_

What is strange Python (3.7.7) reports the error even before Matlab (2020a) console opens.
edit: Win10 OS - maybe that is the issue.

@sqroprzemo
Copy link
Author

Strange to answer myself, nevertheless maybe some other researcher might find it useful.

I found out the problem solution. Matlab (at least current version) requires to install libs.
https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
now it works like a charm (at least for me).

@matthias-k
Copy link
Owner

That is quite strange, since the AIM model in pysaliency doesn't use the matlab engine for python. Instead, pysaliency just calls matlab from the command line. The error message suggests that matlab was using a different directory than the calling pysaliency code. Maybe there was a strange race condition going on.

@sqroprzemo
Copy link
Author

I believe it is because of some strange timeout in windows or new matlab. When the Matlab engine resides in RAM I get response very quickly, otherwise Matlab response is quite delayed.

Anyway, since I have my own stimuli, dozens of Matlab computed salmaps and fixations so I have to use SaliencyMapModelFromDirectory and I found another issue with Windows - it resulted in infinite loop.
It is due pysaliency is oriented towards the unix-alike filesystems. To correct it a modification of line 43 in utils.py is necessary: while components[0] and (components[0] != '/' and components[0][len(components[0])-2:len(components[0])] != ':\\'):.

BTW (offtopic)
Is there any example how to import own fixation sets from local disk?

@JMUB
Copy link

JMUB commented Dec 21, 2022

I have to use SaliencyMapModelFromDirectory and I found another issue with Windows - it resulted in infinite loop.
It is due pysaliency is oriented towards the unix-alike filesystems. To correct it a modification of line 43 in utils.py is necessary: while components[0] and (components[0] != '/' and components[0][len(components[0])-2:len(components[0])] != ':\\'):.

I am using version 0.2.22. I encountered the same infinite loop issue with Windows. I modified the line 43 in utils.py and now loading saliency maps from directory works. Thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants