【环境搭建】ncnn

1,介绍
    ncnn 是一个为手机端极致优化的高性能神经网络前向计算框架。

2, 安装
2.1 编译

git clone https://github.com/Tencent/ncnn.git
cd ncnn
mkdir build
cd build
cmake .. \
	-DNCNN_VULKAN=ON # vulkan支持,必须先安装vulkan
make -j 4

2.2 vulkan

# https://vulkan.lunarg.com/sdk/home,下载,vulkansdk-linux-x86_64-1.2.141.0.tar.gz
tar -xf vulkansdk-linux-x86_64-1.2.141.0.tar.gz
sudo apt install vulkan-utils

# setup vulkan env
export VULKAN_SDK=$HOME/vulkansdk-linux-x86_64-1.2.141.0/x86_64
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$VULKAN_SDK/lib:$LIBRARY_PATH
export VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/explicit_layer.d

3, 模型转换
3.1 onnx -> ncnn

./tools/onnx/onnx2ncnn resnet50.onnx resnet50.param resnet50.bin

得到ncnn所需要模型的resnet50.param和resnet50.bin。

4, ncnn - > android


你可能感兴趣的:(环境搭建)