Open Lvhhhh opened 8 years ago
The problem is, that the executing line of the code, that calls matlab script, doesn't wait for it to end. So the file is generated, but not yet finished. The simplest way is to put a timer after the python line, which calls the matlab script.
If you are using mac for this code, may be you can try this answer: https://www.mathworks.com/matlabcentral/answers/303369-mex-cannot-find-a-supported-compiler-in-matlab-r2015b-after-i-upgraded-to-xcode-8-0
Here is my solution: Download the original Matlab code using script: https://github.com/nightrome/matconvnet-calvin/blob/master/matconvnet-calvin/matlab/setup/downloadSelectiveSearch.m
copy the python code plus selective_search.m from current repo.
matlab:2014a python:2.7 windows
here is the selective_search.py: import tempfile import subprocess import shlex import os import numpy as np import scipy.io
script_dirname = os.path.abspath(os.path.dirname(file))
def get_windows(image_fnames, cmd='selective_search'): """ Run MATLAB Selective Search code on the given image filenames to generate window proposals.
if name == 'main': """ Run a demo. """ import time
when i run python selective_search.py in cmd: it have problem: selective_search({'D:\selective_search_ijcv_with_python\selective_search_ijcv_wi th_python\000015.jpg','D:\selective_search_ijcv_with_python\selective_search_ijc v_with_python\cat.jpg','D:\selective_search_ijcv_with_python\selective_search_ij cv_with_python\000015.jpg','D:\selective_search_ijcv_with_python\selective_searc h_ijcv_with_python\cat.jpg','D:\selective_search_ijcv_with_python\selective_sear ch_ijcv_with_python\000015.jpg','D:\selective_search_ijcv_withpython\selective search_ijcv_with_python\cat.jpg','D:\selective_search_ijcv_with_python\selective _search_ijcv_with_python\000015.jpg','D:\selective_search_ijcv_with_python\selec tive_search_ijcv_with_python\cat.jpg'}, 'c:\users\lh7610~1.arc\appdata\local\tem p\tmpp6f4z8.mat') Traceback (most recent call last): File "selective_search.py", line 63, in
boxes = get_windows(image_filenames)
File "selective_search.py", line 42, in get_windows
all_boxes = list(scipy.io.loadmat(output_filename)['all_boxes'][0])
File "D:\python\lib\site-packages\scipy\io\matlab\mio.py", line 135, in loadma
t
MR = mat_reader_factory(file_name, appendmat, **kwargs)
File "D:\python\lib\site-packages\scipy\io\matlab\mio.py", line 59, in mat_rea
der_factory
mjv, mnv = get_matfile_version(byte_stream)
File "D:\python\lib\site-packages\scipy\io\matlab\miobase.py", line 224, in ge
t_matfile_version
raise MatReadError("Mat file appears to be empty")
scipy.io.matlab.miobase.MatReadError: Mat file appears to be empty
1.the path of my picture is right. 2.i check the c:\users\lh7610~1.arc\appdata\local\temp and found no mat file. 3.i think the matlab cannot produce the mat file even though it has right picture path. 4.i have put the path "D:\selective_search_ijcv_with_python\selective_search_ijcv_with_python" in PYTHONPATH , caffe_ROOT and path. 5.when i "python selective_search",i can see matlab commit windows and disappear in a while. who can help me!!