Ncnn: pytorch->onnx->ncnn调用,运算到中间某层后输出为空

Created on 14 May 2019  ·  10Comments  ·  Source: Tencent/ncnn

Hi,我已经通过直接调用onnx模型验证onnx模型没有问题。
onnx模型转ncnn过程中没有报任何异常,
在实际进行推理时,发现输出层的结果始终为空,但没有报错。
我尝试了一下for循环从1还是按blob_index访问输出,到中间某节点会异常退出:
Process finished with exit code 11
然后,如果单独输出该节点以后的任意节点,输出的blob mat都是空的。
想问一下,这有可能是什么原因?

Most helpful comment

@soham24
Hi, I think you may fix the problem follow these steps:

  1. Check your ONNX model by onnx_runtime package, make sure your format conversion from Pytorch to ONNX is well;
  2. Try to extract the output blob of each node in ncnn.param, and compare with the related result from onnx_runtime. Maybe you can see what the problem node is. ^_^

All 10 comments

遇到同样的问题,求大佬解答一下,谢谢

+1

it was found that the output layer results were always empty, :
I am facing the exact same issue. output layer always returns -100

@nihui

If this bug gets solved then pytorch-->onnx--->ncnn pipeline will work like charm for all modern arch.
looking forward for this issue to get resolve.

@ckf1111 问题解决了:

  1. ONNX转到ncnn的模型,param文件中第二列仍然是blob_name,所以调用的时候需要extractor.extract("123", outputMat);
  2. 我的问题是因为UpSampling,ONNX中相应操作的参数是output scale,而NCNN中默认转成了output factor。而由于精度的问题,导致feature map尺寸到后面就对不上了,我把NCNN param中Interp的参数相应修改成output scale以后就好了。

Can you explain lil more @Wilbur529

@soham24
Hi, I think you may fix the problem follow these steps:

  1. Check your ONNX model by onnx_runtime package, make sure your format conversion from Pytorch to ONNX is well;
  2. Try to extract the output blob of each node in ncnn.param, and compare with the related result from onnx_runtime. Maybe you can see what the problem node is. ^_^

Thank you @Wilbur529 :)

@soham24
Hi, I think you may fix the problem follow these steps:

  1. Check your ONNX model by onnx_runtime package, make sure your format conversion from Pytorch to ONNX is well;
  2. Try to extract the output blob of each node in ncnn.param, and compare with the related result from onnx_runtime. Maybe you can see what the problem node is. ^_^

你好 请问一下,用onnx_runtime检测ONNX模型有好的教程推荐的不?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xhappy picture xhappy  ·  5Comments

jinfagang picture jinfagang  ·  4Comments

SisterL picture SisterL  ·  3Comments

Abel119 picture Abel119  ·  4Comments

AlexeyAB picture AlexeyAB  ·  3Comments