htshinichi / caffe-onnx

caffe model convert to onnx model
MIT License
175 stars 43 forks source link

Failed at layer conv4_3_norm_mbox_loc, layer's bottom not detected ... #18

Open huiofficial opened 4 years ago

huiofficial commented 4 years ago

I try to use your code to convert TensorRT7.0's SSD caffe model to ONNX, I modified the caffe.proto to add all the Ops and it works fine until I met Layer conv4_3_norm_mbox_loc.

In src/caffe-onnx.py I find that the function __getLastLayerOutNameAndShape() cannot read this layers output so the convert is stopped. I find you use import ipdb; ipdb.set_trace() to specifically deal with layer conv4_3_norm_mbox_loc, but I don't know how to use it the right way and help me finish the convert.

Your code is:

if Layers[i].type == "Convolution" or Layers[i].type == Layer_CONVOLUTION:
                #1.获取节点输入名、输入维度、输出名、节点名
                if Layers[i].name == "conv4_3_norm_mbox_loc":
                    import ipdb; ipdb.set_trace()
                inname, input_shape = self.__getLastLayerOutNameAndShape(Layers[i])
                outname = self.__getCurrentLayerOutName(Layers[i])
                nodename = Layers[i].name

Thanks.

huiofficial commented 4 years ago

Besides, I find that Ops doesn't have all the operations I need, but your doc says only to modify my caffe.proto. I wonder whether it matters.

syangdung commented 3 years ago

The code uses the onnx helper.make_node to convert the caffemodel to onnx model. Before calling the helper.make_node, you should get the parameters of the function. It is necessary to define the operators you need in the OPs directory. Before you define the operator, you need to check for the operators that onnx support.

moon142857 commented 3 years ago

我也遇到了。他上一层是Normalize 目前代码里没实现。