1. git clone https://github.com/alibaba/MNN.git
android端参考:https://www.yuque.com/mnn/en/build_android
linux端配置(本次)
2. 编译步骤
a) 为了能够对模型进行量化,请在make之前,在CMakeLists.txt中打开quantize
b) protobuf安装: git clone https://github.com/protocolbuffers/protobuf.git 如果没有autoconf命令,请用下面的命令安装(如果有跳过次步骤) apt-get install autoconf automake libtool
cd protobuf ./autogen.sh # 指定安装路径 ./configure --prefix=/usr/local/protobuf #编译 make # 测试,这一步很耗时间 make check make install # refresh shared library cache. ldconfig
# (动态库搜索路径) 程序加载运行期间查找动态链接库时指定除了系统默认路径之外的其他路径 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/protobuf/lib # (静态库搜索路径) 程序编译期间查找动态链接库时指定查找共享库的路径 export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/protobuf/lib export PATH=$PATH:/usr/local/protobuf/bin
c) 编译MNN cd MNN/tools/converter(严格按照步骤操作) ./generate_schema.sh mkdir build cd build && cmake .. && make -j4
cd MNN
mkdir build
cd build && cmake .. && make -j4