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

Bugfix rare model #82

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Bugfix: Compatibility with torch 2.2 and numpy 2.0
* Bugfix!: The download location of the RARE2012 model changed. The new source code results in slightly different predictions.
* Feature: The RARE2007 model is now available as `pysaliency.external_models.RARE2007`. It's execution requires MATLAB.
* matlab scripts are now called with the `-batch` option instead of `-nodisplay -nosplash -r`, which should behave better.


* 0.2.22:
Expand Down
4 changes: 3 additions & 1 deletion pysaliency/external_models/matlab_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ def __init__(self, location=None, **kwargs):

def _setup(self):
source_location = os.path.join(self.location, 'gbvs')
download_extract_patch('http://www.vision.caltech.edu/~harel/share/gbvs.zip',
url = "http://www.vision.caltech.edu/~harel/share/gbvs.zip"

download_extract_patch(url,
'c5a86b9549c2c0bbd1b7f7e5b663b031',
source_location,
location_in_archive=True,
Expand Down
5 changes: 4 additions & 1 deletion pysaliency/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ def run_matlab_cmd(cmd, cwd=None):
matlab = get_matlab_or_octave()
args = []
if os.path.basename(matlab).startswith('matlab'):
args += ['-nodesktop', '-nosplash', '-r']
# args += ['-nodesktop', '-nosplash', '-r']
args += ['-batch']
args.append("try;{};catch exc;disp(getReport(exc));disp('__ERROR__');exit(1);end;quit".format(cmd))
else:
args += ['--traditional', '--eval']
Expand Down Expand Up @@ -364,6 +365,8 @@ def download_file(url, target, verify_ssl=True):
for data in r.iter_content(32*1024):
f.write(data)
progress_bar.update(32*1024)
if r.status_code in [403, 404, 500, 503]:
raise ValueError("Error downloading file from {}. Status code: {}".format(url, r.status_code))


def download_and_check(url, target, md5_hash, verify_ssl=True):
Expand Down
Loading