Py-faster-rcnn: No module named rpn.proposal_layer

Created on 31 Mar 2016  路  8Comments  路  Source: rbgirshick/py-faster-rcnn

I used VGG16 end2end algorithm in py-faster-rcnn to train a model. I am trying to get the test scores using the following command.

caffe test -model -weights -gpu 0 -iterations 100

I am getting the following error

I0331 07:42:46.740831 5018 layer_factory.hpp:77] Creating layer proposal
ImportError: No module named rpn.proposal_layer

Caffe path is set to py-faster-rcnn's caffe path. Is there anything else I can try to get the test scores?

Most helpful comment

I guess, the reason is that './lib' is not in your PATH. You should use $FRCN_ROOT/tools/test_net.py to do evaluation since it will import _init_paths, which will insert './lib' into your PATH

All 8 comments

Hello,
I'm trying to fine-tune the VGG16.v2.caffemodel. Using the caffe-fast-rcnn version of Caffe, and faster_rcnn_test.pt for the network.

But when I run I get the same error:
I0510 14:45:20.216603 16195 layer_factory.hpp:77] Creating layer proposal
ImportError: No module named rpn.proposal_layer

Did you or anyone else find a solution for this error?

isn't it because rpn.proposal_layer is defined only in python?
I'm not sure but maybe it's because the native caffe interface cannot process Python layer?

layer {
name: 'proposal'
type: 'Python' <====
bottom: 'rpn_cls_prob_reshape'
bottom: 'rpn_bbox_pred'
bottom: 'im_info'
top: 'rois'
python_param {
module: 'rpn.proposal_layer' <====
layer: 'ProposalLayer'
param_str: "'feat_stride': 16"
}
}

I guess, the reason is that './lib' is not in your PATH. You should use $FRCN_ROOT/tools/test_net.py to do evaluation since it will import _init_paths, which will insert './lib' into your PATH

Have you solved your problem? I've faced similar error! :/

I have the same error when I run it in cpp. I implemented a class based on https://github.com/YihangLou/FasterRCNN-Encapsulation-Cplusplus. It works perfectly running the tool/demo.py but when I run the code it throws ImportError: No module named rpn.proposal_layer. The other layers are created perfectly so It might be related with what @chankim said. It seems to be implemented only in python.

Hi, I'm not sure if it is related, but I had the same error trying to read a faster-rcnn network with the C++ faster-rcnn version (https://github.com/D-X-Y/caffe-faster-rcnn/tree/dev). Actually, when using the C++ version, you have to replace the python layer (cited by @chankim) in the deploy.prototxt file by :

layer {
  name: "proposal"
  type: "FrcnnProposal"
  bottom: "rpn_cls_prob_reshape"
  bottom: "rpn_bbox_pred"
  bottom: "im_info"
  top: "rois"
  top: "scores"
}

which is the c++ version of the layer.
The parameters can be set in the config.json file.

see my comment here

I guess, the reason is that './lib' is not in your PATH. You should use $FRCN_ROOT/tools/test_net.py to do evaluation since it will import _init_paths, which will insert './lib' into your PATH

This is the correct answer. Just do the following:-
if "/path/to/py-faster-rcnn/lib" not in sys.path: sys.path.insert(0, ""/path/to/py-faster-rcnn/lib")

Was this page helpful?
0 / 5 - 0 ratings