-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onnx转ncnn的问题 #3
Comments
这个跟onnx的版本也有关系,会给你搞出很多莫名其妙的op,要不你试一下pnnx? 可以直接torchscript转ncnn,不会涉及onnx这个中间商。 https://github.com/Tencent/ncnn/tree/master/tools/pnnx |
@FeiGeChuanShu 感谢回复!我去试试pnnx |
@FeiGeChuanShu 请教一下,使用pnnx进行转换的过程中,是否需要对原网络结构的代码进行修改,您在转换的时候有什么注意事项么,我尝试从torchscript用pnnx转ncnn报错如下 |
@queenmary55 问下你上面的问题了吗 |
@FengMu1995 没有解决。我感觉是level1的时候,就有不支持的算子,在encoder部分的featuremap形状就不太对,最后在decoder部分报错了,out of range。不知道怎么排查错误 |
@FengMu1995 方便留个邮箱联系下吗 |
@queenmary55 请问您后来如何转换成功?是否愿意分享一下?谢谢。即使我使用了onnxsim简化,最后再转换为ncnn时报以下错误(似乎onnxsim没有作用?): |
Hi @FeiGeChuanShu |
pytorch模型转onnx,使用rvm作者给的代码,没报错,但是有警告:
onnx_helper.py:20: TracerWarning: Converting a tensor to a Pyth on number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value wil l be treated as a constant in the future. This means that the trace might not generalize to other inputs! return F.interpolate(x, scale_factor=scale_factor.item(),
使用该onnx模型,进行简化,命令如下:
python -m onnxsim model.onnx model_sim.onnx --dynamic-input-shape --input-shape src:1,3,1280,720 r1i:1,16,256,144 r2i:1,20,128,72 r3i:1,40,64,36 r4i:1,64,32,18 downsample_ratio:1
报错如下
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running Expand node. Name:'Expand_174' Status Message: invalid expand shape
请大神赐教。我用netron查看了onnx模型的网络图,找到了Expand_174节点,该节点是接收一个shape,然后对r4i进行操作(我去onnx的github上查看,说expand操作是广播)onnx中expand操作的解释
但是我仔细查看并打印了decoder.py里面相关位置的tensor形状,没有自动广播的情况
The text was updated successfully, but these errors were encountered: