Open gs-ren opened 2 years ago
I also failed to transfer onnx eca model to ncnn with error "Shape not supported yet".
'Unsqueeze' OP is not supported by ncnn. It should be simplified with onnx-simplifier https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#simplify-onnx-model https://github.com/daquexian/onnx-simplifier
I did the simplication but still failed.
So I implement unsqueeze in another form which replace the "# Two different branches of ECA module" in forward with
y = self.conv(y.squeeze(3).transpose(2, 1)).transpose(2, 1)[:,:,:,None]
However, it still failed with the same error "Shape not supported yet"
I think I can try to use pnnx.
Hi, just try change the implement of ECA to:y = self.conv(y.reshape(batch_size, 1, -1)).reshape(batch_size, -1, 1, 1) , that maybe solve your problem. @KleinXin
针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn
pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]
详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx
error log | 日志或报错信息 | ログ
context | 编译/运行环境 | バックグラウンド
pnnx version:pnnx-20220720-windows ncnn version:pyhton 版本,pip 安装的,1.0.20220729
how to reproduce | 复现步骤 | 再現方法
1.模型取自 https://github.com/BangguWu/ECANet/blob/master/models/eca_mobilenetv2.py
more | 其他 | その他