博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 下 MNN编译 | 安装 | 测试
阅读量:2019 次
发布时间:2019-04-28

本文共 2338 字,大约阅读时间需要 7 分钟。

系统环境: Ubuntu 18.04.5


0


首先安装 protobuf (手动源码安装)


git clone https://github.com/google/protobuf.gitcd protobufgit submodule update --init --recursive./autogen.sh./configure或者 指定 安装目录 (个人用户要指定到 /home/当前用户名/usr/local/ 不然下方可能会报错)./configure --prefix=/home/moli/usr/local/makemake checkmake installldconfig # refresh shared library cache.

git submodule update --init --recursive 执行,可能遇到 benchmark.git 和 googletest.git 下载失败;

我的方法是手动下载这两个 git 库 然后 复制到 protobuf/third_party 进行解压

git submodule update --init --recursive# 报错如下Cloning into 'third_party/benchmark'...error: RPC failed; result=52, HTTP code = 0fatal: The remote end hung up unexpectedlyClone of 'https://github.com/google/benchmark.git' into submodule path 'third_party/benchmark' failed

./autogen.sh 执行遇到报错

./autogen.sh# 报错如下+ mkdir -p third_party/googletest/m4+ autoreconf -f -i -Wall,no-obsolete./autogen.sh: 37: ./autogen.sh: autoreconf: not found
  • 解决方法为
sudo apt-get install cmake-curses-guisudo apt-get install autoconf automake libtool

普通用户 make install 执行遇到报错

root 权限用户应该不会遇到这个问题

libtool:   error: error: cannot install 'libprotoc.la' to a directory not ending in /usr/local/lib
  • 解决方法:个人用户则指定安装到 当前用户 usr/local/ 目录 下,例如
./configure --prefix=/home/moli/usr/local/

MNN 正确编译和安装


git clone https://github.com/alibaba/MNN.gitcd MNNcd schema && ./generate.shcd ..mkdir build && cd buildcmake -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true ..make -j32# 安装完成, 查看 版本./MNNConvert --version0.2.1.5git

Protobuf 如果没有安装可能会遇到如下报错:

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):  Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)Call Stack (most recent call first):..  tools/converter/CMakeLists.txt:14 (find_package)-- Configuring incomplete, errors occurred!
  • Ubuntu 解决方法(似乎还是上面的手动源码安装能够根本解决)
sudo apt-get install libprotobuf-dev protobuf-compilerprotoc --version# 输出如下libprotoc 3.0.0

Demo 2.1 姿态检测 ( TF 模型转换 MNN 测试 )


  • 我的转换命令如下( MNN/build 目录下 ):
./MNNConvert -f TF --modelFile ../../changeModel/model-mobilenet_v1_075.pb --MNNModel mobilenet.mnn --bizCode biz# 输出如下:MNNConverter Version: 0.2.1.5git - MNN @ 2018Start to Convert Other Model Format To MNN Model...Start to Optimize the MNN Net...Converted Done!
  • 选择图片进行测试

选取一张人像图像 test.png 安放在 MNN/build/test 目录下

执行命令如下:

./multiPose.out mobilenet.mnn test/test.png pose.png
  • 效果如下

1-1

1-2


恭喜你已经读到文末啦,多谢你的点赞鼓励!

9-9


转载地址:http://qcmxf.baihongyu.com/

你可能感兴趣的文章
(12) Hadoop 升级技能
查看>>
(总结)Nginx配置文件nginx.conf中文详解
查看>>
wget 下载
查看>>
HTTPS的七个误解
查看>>
ssl证书配置
查看>>
为什么使用<!DOCTYPE HTML>
查看>>
leetcode 451 Sort Characters By Frequency C++
查看>>
leetcode 477 Total Hamming Distance C++
查看>>
笑话收集
查看>>
超级程序员神话
查看>>
advanced installer制作windows软件安装界面
查看>>
操作系统读书笔记
查看>>
2017年计划
查看>>
【转】电容滤波的两个要点_Detective_ALong_新浪博客
查看>>
html5星星评分组件,sass双循环写法
查看>>
h5锁屏提醒-锁横屏和锁竖屏
查看>>
LeetCode 方法详解
查看>>
View事件分发情况总结
查看>>
运放(二):运放带宽
查看>>
activiti入门列子一个简单的activiti请假流程
查看>>