ncnn编译依赖OpenCV和protobuf
一、安装OnenCV
下载 Releases · opencv/opencv · GitHub
以OpenCV 4.5.4为例,下载Source code (zip),
##源码编译
unzip opencv-4.5.4.zip
cd opencv-4.5.4
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
sudo make install
sudo ldconfig
二、安装protobuf
下载Releases · protocolbuffers/protobuf · GitHub
unzip protobuf-all-3.19.1.zip
cd protobuf-all-3.19.1
./configure --prefix=/usr/local
make -j4
sudo make install
sudo ldconfig
三、安装NCNN
1、编译NCNN
git clone https://github.com/Tencent/ncnn.git
cd ncnn
mkdir build
cd build
cmake ..
make
make install
2.ONNX转换NCNN
ncnn编译完后,在build/tools/onnx里会生成个可执行文件onnx2ncnn
./onnx2ncnn mobilenetv2.onnx mobilenetv2.param mobilenetv2.bin