Tencent / TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
Other
4.41k stars 771 forks source link

ONNX模型转tnn失败 #1797

Closed shiyutang closed 1 year ago

shiyutang commented 2 years ago

1. 使用环境(environment)

1627180283 commented 2 years ago

可以在转换命令里加上 -debug 打印出详细日志看一下

shiyutang commented 2 years ago

增加选项之后日志如下:mobilenetv3.log

image
shiyutang commented 2 years ago

我发现增加了pooling代码均会存在,转tnn时与上面相同的错误:D/tnn: get_node_attr_ai [File /opt/TNN/tpython3: /opt/TNN/tools/onnx2tnn/src/core/layer/onnx_converter_pool.cc:132: virtual std::__cxx11::string OnnxOpConverterPool::TNNLayerParam(onnx::NodeProto&, OnnxNetInfo&): Assertion `0' failed. 查看代码之后发现是pooling的pads.size落在不支持的范畴:

5c3b118fe4432dd0417b600c77b3c70f

目前转模型会错误的代码示例如下,不知道能否如何修改pool参数,使其能成功被tnn支持?

f8eab23692f8fc38980717736608264b 84a9536473990a7f8ef1da6edb75e112
1627180283 commented 2 years ago

可以把 AdaptiveAvgPool 换成 AvgPool,同时显式的设置 kernel size 和 padding 看看

1627180283 commented 1 year ago

issue 长时间没有回复,先关闭了,如果有需要的话可以再打开