tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Error loading the caffe2 model into onnx.

Open ayush1999 opened this issue 6 years ago • 6 comments

I followed the steps mentioned in the tutorial to convert the a detectron pretrained caffe2 model into ONNX model. Here's the stacktrace of my error:

WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
WARNING:root:Debug message: No module named 'caffe2.python.caffe2_pybind11_state_gpu'
WARNING:caffe2.python.workspace:Original python traceback for operator `102` in network `detectron_e2e_faster_rcnn_R-50-C4_1x_35857197` in exception above (most recent call last):
Traceback (most recent call last):
  File "main.py", line 24, in <module>
    value_info,
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/caffe2/python/onnx/frontend.py", line 332, in caffe2_net_to_onnx_model
    model = make_model(cls.caffe2_net_to_onnx_graph(*args, **kwargs),
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/caffe2/python/onnx/frontend.py", line 221, in caffe2_net_to_onnx_graph
    inputs)
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/caffe2/python/onnx/helper.py", line 62, in c2_native_run_net
    ws.RunNetOnce(predict_net)
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/caffe2/python/onnx/workspace.py", line 63, in f
    return getattr(workspace, attr)(*args, **kwargs)
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/caffe2/python/workspace.py", line 199, in RunNetOnce
    StringifyProto(net),
  File "/home/ayush99/anaconda3/lib/python3.6/site-packages/caffe2/python/workspace.py", line 178, in CallWithExceptionIntercept
    return func(*args, **kwargs)
RuntimeError: [enforce fail at generate_proposals_op.cc:205] im_info_tensor.dims() == (vector<TIndex>{num_images, 3}). 0 vs 1 3 Error from operator: 
input: "rpn_cls_probs_1" input: "rpn_bbox_pred_1" input: "im_info_0" input: "anchor_0" output: "rpn_rois_1" output: "rpn_roi_probs_1" name: "" type: "GenerateProposals" arg { name: "nms_thres" f: 0.7 } arg { name: "min_size" f: 0 } arg { name: "spatial_scale" f: 0.0625 } arg { name: "correct_transform_coords" i: 1 } arg { name: "post_nms_topN" i: 1000 } arg { name: "pre_nms_topN" i: 6000 }

Any idea what could be going wrong here?

ayush1999 avatar Jul 24 '18 18:07 ayush1999

Hey there, is the issue solved? I am running into the same issue for a Faster-RCNN model

ramanathan831 avatar Aug 23 '18 10:08 ramanathan831

ONNX does not have the corresponding ops yet. https://github.com/onnx/onnx/pull/1010

houseroad avatar Aug 28 '18 00:08 houseroad

@ram1897 Have you successfully exported an onnx model of faster rcnn in Caffe2 by now?

arenchdlaam avatar Nov 07 '18 02:11 arenchdlaam

+1. Have anyone successfully run it?

lilichu avatar Nov 17 '18 05:11 lilichu

@ram1897 @arenchdlaam @ayush1999 Hi guys, have you figured it out yet? I had problem in converting detectron caffe2 model (model.pb, model_int.pb, model.pbtxt) into onnx one. Thank you!

civilpat avatar May 28 '19 14:05 civilpat

any one solve it?

kangkang59812 avatar Nov 08 '19 15:11 kangkang59812