一.安装软件

1.安装 Visual Studio

  下载Visual Studio 社区版就可以 ,下载链接:https://visualstudio.microsoft.com/zh-hans/downloads/  

  注意:安装时勾选“Python开发”和“C++桌面开发”

2.安装cmake 

  官网:https://cmake.org/

3.安装git

  下载链接:https://git-scm.com/download

4.安装pycocotools

pip install cypython
git clone https://github.com/philferriere/cocoapi.git
cd cocoapi/PythonAPI
python setup.py install --user

5.安装protobuf

  下载protobuf-3.4.0安装包,并解压,下载链接:链接:https://pan.baidu.com/s/1bL3e4noBFw0n_u3mExPJIg  提取码:1byq

    解压到D:\protobuf-3.4.0,我是在d盘

  使用命令执行下面命令

 

 

cd protobuf的目录
mkdir build-vs2022
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

编译后执行

protoc.exe --version

打印 libprotoc 3.4.0,安装完成

6.克隆和安装ncnn

 

  克隆ncnn

git clone https://github.com/Tencent/ncnn.git
cd ncnn 的目录
mkdir -p build-vs2022   cd build-vs2022
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=D:/protobuf-3.4.0/build-vs2022/install/include -DProtobuf_LIBRARIES=D:/protobuf-3.4.0/build-vs2022/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=D:/protobuf-3.4.0/build-vs2022/install/bin/protoc.exe -DNCNN_VULKAN=OFF ..

上面根据自己的protobuf目录更改三处

nmake

nmake install

编译后 ncnn\build-vs2022\tools\onnx下有onnx2ncnn.exe说明安装成功

 

posted @ 2022-05-06 10:19  刘文华  阅读(147)  评论(0编辑  收藏  举报