在这篇博客中我讲解了如何本地安装编译ncnn和protobuf:NCNN在windows-VS2022部署(一)——安装并编译ncnn和protobuf-CSDN博客
今天讲解如何将ONNX模型转换为NCNN模型,提供了两种方法:
一、用ncnn编译后的模型转换工具
S1:cd 进入包含模型转换工具的bin文件夹中,bin文件中包含onnx2ncnn.exe
cd D:\PC_Project\ONNX2NCNN\ncnn\build-vs22\install\bin
S2:然后运行如下命令即可
onnx2ncnn.exe <.onnx文件路径> <.param文件的保存路径> <.bin文件的保存路径>
我的示例:
onnx2ncnn.exe "C:\Users\admin\Desktop\ncnn_test\polygon_best_2k.onnx" "C:\Users\admin\Desktop\ncnn_test\polygon_best_2k.param" "C:\Users\admin\Desktop\ncnn_test\polygon_best_2k.bin"
二、本地转换工具
这篇博客中提出了一个转换工具:ONNX转NCNN工具:简化模型转换的利器-CSDN博客
自行下载安装(转换工具下载链接:https://gitcode.com/open-source-toolkit/74771/overview)
转换后的模型可能会有一些错误,根据错误自行修改!!!