Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.58k stars 4.18k forks source link

yolov5s转ncnn报错Unsupported slice axes ! #3476

Open yu937861 opened 2 years ago

yu937861 commented 2 years ago

error log | 日志或报错信息 | ログ

./onnx2ncnn yolov5s-onnxsim.onnx yolov5s.param yolov5s.bin

Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes !

model | 模型 | モデル

  1. original model yolov5s.pt

    how to reproduce | 复现步骤 | 再現方法

  2. 2022.1.3 clone最新u版yolov5和ncnn训练完后使用yolov5中export.py 导出yolov5s.onnx并onnxsim 转为yolov5s-onnxsim.onnx
  3. 使用detect.py 测试yolov5s-onnxsim.onnx可以检测出目标
  4. 执行/onnx2ncnn yolov5s-onnxsim.onnx yolov5s.param yolov5s.bin 报错
  5. Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes !
sdnusqy-art commented 2 years ago

error log | 日志或报错信息 | ログ

./onnx2ncnn yolov5s-onnxsim.onnx yolov5s.param yolov5s.bin

Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes !

model | 模型 | モデル

  1. original model yolov5s.pt

how to reproduce | 复现步骤 | 再現方法

  1. 2022.1.3 clone最新u版yolov5和ncnn训练完后使用yolov5中export.py 导出yolov5s.onnx并onnxsim 转为yolov5s-onnxsim.onnx
  2. 使用detect.py 测试yolov5s-onnxsim.onnx可以检测出目标
  3. 执行/onnx2ncnn yolov5s-onnxsim.onnx yolov5s.param yolov5s.bin 报错
  4. Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes ! Unsupported slice axes !

遇到同样问题, 请问解决了吗?

nihui commented 2 years ago

https://zhuanlan.zhihu.com/p/471357671 参考这个文章,用 pnnx 转换模型

oyjs1989 commented 1 year ago

export onnx model with --train

nihui commented 3 months ago

针对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