selective_search_ijcv_with_python icon indicating copy to clipboard operation
selective_search_ijcv_with_python copied to clipboard

problem with detect.py using selective_search

Open sailes437 opened this issue 10 years ago • 12 comments

I am trying to run a detection program on caffe (https://github.com/BVLC/caffe) the file detect.py uses selective search. I have downloaded the selective_search_ijcv_with_python. The demo.m file runs fine with MATLAB and works. Also the selective_search.py file executes fine and gives result. But when i try to run detect.py file (that uses selective search) it schows error. File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/miobase.py", line 217, in get_matfile_version buffer = fileobj.read(4)) TypeError: buffer is too small for requested array I have found some forum talks saying that it has something to do with scipy, numpy but i dont understand what. Thanks in advance.

sailes437 avatar Oct 27 '14 12:10 sailes437

I had the same problem.:(

cmxnono avatar Oct 31 '14 11:10 cmxnono

This usually means that the Matlab code is actually not outputting anything meaningful. Look at the temporary file that selective search outputs -- it's probably 0 bytes.

On Fri, Oct 31, 2014 at 4:26 AM, cmxnono [email protected] wrote:

I had the same problem.:(

— Reply to this email directly or view it on GitHub https://github.com/sergeyk/selective_search_ijcv_with_python/issues/6#issuecomment-61247798 .

sergeyk avatar Nov 02 '14 17:11 sergeyk

@sergeyk I think all of us are following the guidelines from the webpage below. http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/detection.ipynb So do you have any advice when facing TypeError: buffer is too small for requested array?

Thank you!

ghost avatar Nov 05 '14 17:11 ghost

Find the file that python is trying to load and confirm that it actually has contents (matlab can open it). If it doesn't, the matlab code isn't being called correctly or isn't doing what it's supposed to -- there's a number of possible reasons for that, and you'll have to figure it out.

On Wed, Nov 5, 2014 at 9:02 AM, viczong [email protected] wrote:

@sergeyk https://github.com/sergeyk I think all of us are following the guidelines from the webpage below.

http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/detection.ipynb So do you have any advice when facing TypeError: buffer is too small for requested array?

Thank you!

— Reply to this email directly or view it on GitHub https://github.com/sergeyk/selective_search_ijcv_with_python/issues/6#issuecomment-61842912 .

sergeyk avatar Nov 05 '14 17:11 sergeyk

@sergeyk I get to know the problem just now, thank you for your quick reply!

To all that may face this problem:

If you follow the instruction from http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/detection.ipynb and face the above problem, you should check _temp folder and to see whether the path mentioned in det_input.txt is right.

ghost avatar Nov 05 '14 17:11 ghost

The problem was because the path to the image was not correct. So the .mat file was not created correctly. Thanks for all your help :)

sailes437 avatar Nov 06 '14 03:11 sailes437

If others are having this same problem even after fixing the image path, here's how I solved this problem: the matlab scripts in this project require the Image Processing toolkit add-on to be installed, so it's not enough to have a standalone student version of Matlab. After I installed the Image Processing add-on, this error went away and the module worked as expected.

tminkus avatar Jan 15 '15 16:01 tminkus

Hi I am trying to use selective search on a 8-channel image, and I am facing similar error

File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/miobase.py", line 217, in get_matfile_version buffer = fileobj.read(4)) TypeError: buffer is too small for requested array

But if I follow the instruction from http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/detection.ipynb and test it on a (3channel) RGB image it works fine. Is it because selective search cannot work on a k-channel image ?

mtrth avatar Jul 23 '15 16:07 mtrth

Thank you so much !!!

byshen avatar Oct 07 '15 07:10 byshen

@sergeyk when i write python selective_search.py . and it say: scipy.io.matlab.miobase.MatReadError: Mat file appears to be empty. my platform is windows.and i change"\dev\null" to "NUL".

Lvhhhh avatar Oct 26 '16 09:10 Lvhhhh

@Lvhhhh I have the same problem did you solve it yet?

fmsxwbh avatar Jul 05 '17 14:07 fmsxwbh

i changed '/dev/null' to os.devnull

pond918 avatar Nov 02 '17 04:11 pond918