随笔 - 93  文章 - 0  评论 - 3  阅读 - 46392

onnx 简化压缩 onnxsim 以及op算子错误解决

 pip install onnx-simplifier -i https://mirror.baidu.com/pypi/simple  

0、安装如上;

1、用法命令

onnxsim 12345.onnx 12345sim.onnx --input-shape 1,3,512,512 

2、出现op错误,注意修改导出onnx文件的

torch.onnx.export版本,
opset_version=11
如下
torch.onnx.export(
        modnet.module, dummy_input, args.output_path, export_params = True, 
        input_names = ['input'], output_names = ['output'], 
        dynamic_axes = {'input': {0:'batch_size', 2:'height', 3:'width'}, 'output': {0: 'batch_size', 2: 'height', 3: 'width'}},opset_version=11)

 

posted on   WenJXUST  阅读(2323)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示