microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.8k stars 965 forks source link

Fail to Convert resnet from Caffe to onnx and Pytorch #932

Open payal211 opened 2 years ago

payal211 commented 2 years ago

Hi,

I am getting below error while converting Resnet Model From caffe to onnx:

I0217 14:18:15.896023 8924 net.cpp:196] Top shape: 1 24 14 14 (4704) I0217 14:18:15.896029 8924 layer_factory.hpp:77] Creating layer proposal ImportError: No module named 'rpn' Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/python_3_5/bin/mmconvert", line 8, in sys.exit(_main()) File "/home/ubuntu/anaconda3/envs/python_3_5/lib/python3.5/site-packages/mmdnn/conversion/_script/convert.py", line 102, in _main ret = convertToIR._convert(ir_args) File "/home/ubuntu/anaconda3/envs/python_3_5/lib/python3.5/site-packages/mmdnn/conversion/_script/convertToIR.py", line 16, in _convert transformer = CaffeTransformer(args.network, args.weights, "tensorflow", inputshape[0], phase = args.caffePhase) File "/home/ubuntu/anaconda3/envs/python_3_5/lib/python3.5/site-packages/mmdnn/conversion/caffe/transformer.py", line 325, in init graph = GraphBuilder(def_path, self.input_shape, self.is_train_proto, phase).build() File "/home/ubuntu/anaconda3/envs/python_3_5/lib/python3.5/site-packages/mmdnn/conversion/caffe/graph.py", line 454, in build graph.compute_output_shapes(self.model) File "/home/ubuntu/anaconda3/envs/python_3_5/lib/python3.5/site-packages/mmdnn/conversion/caffe/graph.py", line 263, in compute_output_shapes net = caffe.Net(tmp_prototxt, caffe.TEST) SystemError: <Boost.Python.function object at 0x2ccfd50> returned NULL without setting an error

Anyone can please help to figure it out? Thank you.

Below are system Specifications and command I used to convert: Platform (like ubuntu 16.04/win10): ubuntu 16.04

Python version: 3.5

Source framework with version (like Tensorflow 1.4.1 with GPU): CAFFE

Destination framework with version (like CNTK 2.3 with GPU): ONNX or PYTORCH

Running scripts: mmconvert --srcFramework caffe --inputWeight ./AMAR_MODELS/ctd_tloc_iter_91000_bkup_2_11_CW.caffemodel --inputNetwork ./AMAR_MODELS/test_ctd_tloc.prototxt --dstFramework onnx --outputModel ctd_tloc_iter_91000_bkup_2_11_CW.onnx --inputShape 1 3 224 224