ncnn测试nanodet环境搭建

ncnn测试nanodet环境搭建
我的环境:win7+VS2019+cmake

按照demo:https://github.com/RangiLyu/nanodet/tree/main/demo_ncnn

1.安装Vulkan。

我直接选了最新版,然后傻瓜式直接下一步下一步。完成之后重启一下。Vulkan就会直接的自动添加到环境目录中了。

2.安装ncnn

打开类似命令行输入器:
Start the command prompt: Start → Programs → Visual Studio 2017 → Visual Studio Tools → x64 Native Tools Command Prompt for VS 2017
下载安装protobuf
Download protobuf-3.4.0 from https://github.com/google/protobuf/archive/v3.4.0.zip

> cd <protobuf-root-dir>
> mkdir build
> cd build
> 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

编译ncnn

$ git clone https://github.com/Tencent/ncnn.git
$ cd ncnn
$ git submodule update --init

然后

> cd <ncnn-root-dir>
> mkdir -p build
> cd build
> cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=<protobuf-root-dir>/build/install/include -DProtobuf_LIBRARIES=<protobuf-root-dir>/build/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=<protobuf-root-dir>/build/install/bin/protoc.exe -DNCNN_VULKAN=ON ..
> nmake
> nmake install

这里的protobuf-root-dir 路径,直接找你安装protobuf位置就好了,大概这样的格式就行

cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=D:/life_b/protobuf/protobuf-3.4.0/build/install/include -DProtobuf_LIBRARIES=D:/life_b/protobuf/protobuf-3.4.0/build/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=D:/life_b/protobuf/protobuf-3.4.0/build/install/bin/protoc.exe -DNCNN_VULKAN=ON ..

完了之后
3.编译nanodet的C++例子

git clone https://github.com/RangiLyu/nanodet.git
cd nanodet\demo_ncnn

修改一下main.cpp文件。将

std::vector<std::string> filenames;

改为

std::vector<cv::String> filenames;

修改cmake.txt
将这里设置为你的ncnn位置

set(NCNN_LIBS D:/life_b/ncnn/build/install/lib)
set(NCNN_INCLUDE_DIRS D:/life_b/ncnn/build/install/include)

然后

mkdir -p build
cd build
cmake ..
msbuild nanodet_demo.vcxproj /p:configuration=release /p:platform=x64

下载训练好的模型

https://github.com/RangiLyu/nanodet/releases/download/v0.0.1/nanodet_ncnn_model.zip

进入Release目录,将下载好的nanodet_m.bin,nanodet_m.param放入进去。再放入一两张图片到这里
最后在在“x64 Native Tools Command Prompt for VS 2019“ 就是命令框。或者你用cmd也行的。
输入

nanodet_demo 1 ./*.jpg

最后效果:
在这里插入图片描述

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值