该内容还未完整,笔记内容,后期补充。
一、模型转换
yolov5s v6.2训练的pt模型,直接导tourchscript,然后时候ncnn里面的pnnx工具直接转换为ncnn
二、部署环境
1.安装vunlkan 1.2.198.1版本,记得配置环境变量
2.安装Protobuf3.20.0版本
下载地址(国内很慢,挂加速器还是咋滴自己想办法):https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protobuf-cpp-3.20.0.tar.gzhttps://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protobuf-cpp-3.20.0.tar.gz
官方文档:
https://github.com/Tencent/ncnn/wiki/FAQ-ncnn-protobuf-problem.zhhttps://github.com/Tencent/ncnn/wiki/FAQ-ncnn-protobuf-problem.zh
编译Protobuf命令 :
mkdir build_vs
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
nmake
nmake install
3.编译ncnn
下载ncnn完整源码:
https://github.com/Tencent/ncnn/releaseshttps://github.com/Tencent/ncnn/releases
直接下载发行版本的完整代码,然后解压,用以下命令编译,自行替换Protobuf的编译路径,其中DNCNN_VULKAN=ON表示不使用Vunlkan加速
mkdir build_vs
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=D:\protobuf-cpp-3.20.0\protobuf-cpp-3.20.0\protobuf-3.20.0\build_vs\install/include -DProtobuf_LIBRARIES=D:\protobuf-cpp-3.20.0\protobuf-cpp-3.20.0\protobuf-3.20.0\build_vs\install/lib/libprotobuf.lib -Dprotobuf_DIR=D:\protobuf-cpp-3.20.0\protobuf-cpp-3.20.0\protobuf-3.20.0\build_vs/install/cmake -DProtobuf_PROTOC_EXECUTABLE=D:\protobuf-cpp-3.20.0\protobuf-cpp-3.20.0\protobuf-3.20.0\build_vs\install/bin/protoc.exe -DNCNN_VULKAN=ON ..
ncmake
ncmake install