onnx转ncnn报错Shape not supported yet! Gather not supported yet # axis=0 Unsupported unsqueeze axes ! U

# 在将pt模型转为onnx之后,将onnx转成ncnn
./onnx2ncnn ~/projects/pytorch-classification/mobilenet.onnx mobilenet.param mobilenet.bin

# 如果网络结构中用到了reshape或者view,可能会报以下错误
Shape not supported yet!
Gather not supported yet!
# axis=0
Unsupported unsqueeze axes !
Unknown data type 0

# pt转换的onnx有很多冗余需要简化
# 可以借助onnx-simplifier
pip install onnx-simplifier
python -m onnxsim mobilenet.onnx mobilenet_sim.onnx

# 然后再在ncnn的环境下执行,就可以成功转换
./onnx2ncnn ~/projects/pytorch-classification/mobilenet_sim.onnx mobilenet.param mobilenet.bin

posted @ 2022-05-05 18:24  刘文华  阅读(975)  评论(0编辑  收藏  举报