1. Android SDK 下载:http://sdk.android-studio.org/
2. Android NDK 下载:https://pan.baidu.com/s/1c17ze2c
3. TensorFlow 源码下载:https://github.com/tensorflow/tensorflow
4. Bazel 构建工具 下载:https://docs.bazel.build/versions/master/install-windows.html
二、更改配置文件:
打开下载下来的TensorFlow中的WROKSPACE文件,修改结果如下(注意设置正确的SDK和NDK路径):
android_sdk_repository(
name = "androidsdk",
api_level = 26, //sdk对应版本
# Ensure that you have the build_tools_version below installed in the
# SDK manager as it updates periodically.
build_tools_version = "26.0.1",//build-tools对应版本
# Replace with pathto Android SDKon your system
path = "/xxx/sdk",//sdk路径
)
android_ndk_repository(
name="androidndk",
path="/xxx/ndk",//ndk路径
# This needs to be 14 or higher to compile TensorFlow.
# Note that the NDK version is not the API level.
api_level=14//ndk版本
)
三、编译Android客户端所需函数库文件编译so:
$ bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a
$ bazel build //tensorflow/contrib/android:android_tensorflow_inference_java
四、Tensorflow数据模型下载:
里面包含两个文件:
字典标签: imagenet_comp_graph_label_strings.txt
预训练的模型文件: tensorflow_inception_graph.pb
课程直播地址:http://edu.csdn.net/course/detail/6412
更多资讯及文章可关注我的公众号