Android TensorFlow环境搭建
博客专区 > SuShine 的博客 > 博客详情
Android TensorFlow环境搭建
SuShine 发表于3个月前
Android TensorFlow环境搭建
  • 发表于 3个月前
  • 阅读 9
  • 收藏 0
  • 点赞 0
  • 评论 0

华为云·免费上云实践>>>   

0. python学习教程

http://www.jianshu.com/p/2f542b79658f?utm_campaign=maleskine&utm_content=note&utm_medium=pc_all_hots&utm_source=recommendation

1.在Linux上安装tensor flow开发环境

http://www.jianshu.com/p/5b4e961f010f

 

2.安装bazel 

https://docs.bazel.build/versions/master/install-ubuntu.html#install-on-ubuntu

3.  安装setuptools

这个安装包,是python的一套便于下载,安装,更新和卸载软件包的套件。本地的安装版本是34.3.2,可以在此处下载

wget https://pypi.python.org/packages/de/b2/b63accae9aa1a4cf02e03c7522102f686a1bd9b8b1b847716198152d2c63/setuptools-34.3.2-py2.py3-none-any.whl#md5=0d9c6a1da32797da04bde303e4d623d9  #下载指令
pip install setuptools-34.3.2-py2.py3-none-any.whl  #安装指令

[root@bogon tool]# pip install setuptools-34.3.2-py2.py3-none-any.whl 
Processing ./setuptools-34.3.2-py2.py3-none-any.whl
Requirement already satisfied: six>=1.6.0 in /usr/lib/python2.7/site-packages (from setuptools==34.3.2)
Collecting appdirs>=1.4.0 (from setuptools==34.3.2)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools==34.3.2)
  Downloading packaging-16.8-py2.py3-none-any.whl
Requirement already satisfied: pyparsing in /usr/lib/python2.7/site-packages (from packaging>=16.8->setuptools==34.3.2)
Installing collected packages: appdirs, packaging, setuptools
  Found existing installation: setuptools 0.9.8
    Uninstalling setuptools-0.9.8:
      Successfully uninstalled setuptools-0.9.8
Successfully installed appdirs-1.4.3 packaging-16.8 setuptools-34.3.2

 

 

4. 编译SO和jar(也可以从http://ci.tensorflow.org/job/tensorflow-master-android/现在最新编译ok的so和jar), 以及一个可以运行的TensorFlow android实例 http://www.jianshu.com/p/78f4235655ce

编译遇到的问题汇总

1.Please set JAVA_HOME
更改profile, 指向 user/lib/jvm/javaXXX

2.NDK一定使用r12b

3.Build tools使用26.0.1

4.WARNING: 
CONFLICT: asset:WORKSPACE is provided with ambiguous priority from:
	external/speech_commands/WORKSPACE
	external/mobile_ssd/WORKSPACE
CONFLICT: asset:WORKSPACE is provided with ambiguous priority from:
	external/stylize/WORKSPACE
	external/speech_commands/WORKSPACE
CONFLICT: asset:WORKSPACE is provided with ambiguous priority from:
	external/mobile_ssd/WORKSPACE
	external/inception5h/WORKSPACE
ERROR: /home/sfshine/.cache/bazel/_bazel_sfshine/c024181e917fa803746766c3bb44031b/external/protobuf_archive/BUILD:133:1: C++ compilation of rule '@protobuf_archive//:protobuf' failed (Exit 1)
In file included from external/protobuf_archive/src/google/protobuf/wire_format.h:44:0,
                 from external/protobuf_archive/src/google/protobuf/any.pb.cc:17:
external/protobuf_archive/src/google/protobuf/descriptor.pb.h:1270:45: internal compiler error: Segmentation fault
   void set_default_value(const char* value, size_t size);
                                             ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://source.android.com/source/report-bugs.html> for instructions.
Target //tensorflow/examples/android:tensorflow_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.

此问题是系统cpu出错了,重新编译一次即可


编译SO 和jar
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/android

、

 


 

可以在Android上运行的demo

链接: https://pan.baidu.com/s/1pLkIyuv 密码: madc

 

共有 人打赏支持
粉丝 118
博文 312
码字总数 79453
×
SuShine
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: