onnx / tutorials

Tutorials for creating and using ONNX models
Apache License 2.0
3.39k stars 630 forks source link

Error loading the caffe2 model into onnx. #51

Open ayush1999 opened 6 years ago

ayush1999 commented 6 years ago

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?

ramanathan831 commented 6 years ago

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

houseroad commented 6 years ago

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

arenchdlaam commented 6 years ago

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

lilichu commented 6 years ago

+1. Have anyone successfully run it?

civilpat commented 5 years ago

@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!

kangkang59812 commented 5 years ago

any one solve it?