Caffe: RCNN tutorial Selective_search issue: .squeeze(axis=(2, 3)) axis out of bounds

Created on 9 Jul 2015  ·  3Comments  ·  Source: BVLC/caffe

Hi
I'm going through the tutorial for setting up the R-CNN with Selective Search (http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/detection.ipynb)

When I run this step

../python/detect.py --crop_mode=selective_search --pretrained_model=../models/bvlc_reference_rcnn_ilsvrc13/bvlc_reference_rcnn_ilsvrc13.caffemodel --model_def=../models/bvlc_reference_rcnn_ilsvrc13/deploy.prototxt --gpu --raw_scale=255 _temp/det_input.txt _temp/det_output.h5

I first received the error

[... caffe layer output ...]
cnn_ilsvrc13.caffemodel
I0708 17:57:06.162698 5843 upgrade_proto.cpp:626] Successfully upgraded file specified using deprecated V1LayerParameter
Loading input...
Traceback (most recent call last):
File "/usr/local/caffe/python/detect.py", line 173, in
main(sys.argv)
File "/usr/local/caffe/python/detect.py", line 144, in main
detections = detector.detect_selective_search(inputs)
File "/usr/local/caffe/python/caffe/detector.py", line 115, in detect_selective_search
import selective_search_ijcv_with_python as selective_search
ImportError: No module named selective_search_ijcv_with_python

This error actually makes sense since the .py file in the selective_search_ijcv_with_python directory is not called "selective_search_ijcv_with_python.py" but just "selective_search.py".
Since I don't have the permission to change the code in the detector.py I tried just changing the name of the "selective_search.py" to "selective_search_ijcv_with_python.py".

However now when I run the detect.py again I get a different error:

selective_search_rcnn({'/home/cvg/lhertel/caffe/examples/images/fish-bike.jpg'}, '/tmp/tmpOu7hGx.mat')
Traceback (most recent call last):
File "/usr/local/caffe/python/detect.py", line 173, in
main(sys.argv)
File "/usr/local/caffe/python/detect.py", line 144, in main
detections = detector.detect_selective_search(inputs)
File "/usr/local/caffe/python/caffe/detector.py", line 123, in detect_selective_search
return self.detect_windows(zip(image_fnames, windows_list))
File "/usr/local/caffe/python/caffe/detector.py", line 86, in detect_windows
predictions = out[self.outputs[0]].squeeze(axis=(2, 3))
ValueError: 'axis' entry 2 is out of bounds [-2, 2)

Has anybody else come across this error or do you have suggestions how to deal with it? I am starting to doubt that just changing the filename would be the right thing to do. However, I also don't want to start messing with files that are also being used by other people here (i.e. the detector.py)

Thanks,

Lars

Most helpful comment

I solved it by simply deleting the axis=(2, 3) part so that the command is .squeeze()

So far I haven't come across any errors further down the line using this.

Thanks Sean, I will check out Fast R-CNN

All 3 comments

Same question as yours! Who can give an explanation?

It looks like this is using the old API, when all blobs were 4D. Blobs are now N-dimensional, and commands like .squeeze(axis=(2, 3)) are no longer necessary. The file detector.py (and possibly others) needs to be updated to the new API.

My guess is that nobody is using that particular file, which is why the issue wasn't raised until now. If you want to do object detection, I recommend using Fast R-CNN (https://github.com/rbgirshick/fast-rcnn) which is both faster and more accurate.

I solved it by simply deleting the axis=(2, 3) part so that the command is .squeeze()

So far I haven't come across any errors further down the line using this.

Thanks Sean, I will check out Fast R-CNN

Was this page helpful?
0 / 5 - 0 ratings