官网:https://github.com/onnx/onnx

  1. 安装:pip install onnx
  2. 利用pytorch自带的torch.onnx模块导出 .onnx模型文件:
    https://pytorch.org/docs/stable/onnx.html#id4
    https://blog.csdn.net/baidu_34595620/article/details/112176278
  3. 读取.onnx文件:

import onnx
model = onnx.load(r’C:\Users\Win10\Desktop\Pyramids.onnx’ )
print(model)
4. 安装onnxruntime
pip install onnxruntime-gpu
https://www.onnxruntime.ai
版本参考:https://www.onnxruntime.ai/docs/reference/execution-providers/CUDA-ExecutionProvider.html#requirements
在这里插入图片描述
我的duda是10.1
pip install onnxruntime-gpu==1.4
6. C++通过onnxruntime对.onnx模型的使用
样例:https://github.com/microsoft/onnxruntime/blob/master/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/CXX_Api_Sample.cpp

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐