Android README.md tweaks: improve instructions and add links to prebuilt native libraries.
Change: 144018232
This commit is contained in:
parent
2413caa54f
commit
ee79ebd9bb
@ -37,7 +37,8 @@ People who are a little more adventurous can also try our nightly binaries:
|
|||||||
* Linux GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/))
|
* Linux GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/))
|
||||||
* Mac CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.12.1-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.12.1-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/))
|
* Mac CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.12.1-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.12.1-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/))
|
||||||
* Mac GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/))
|
* Mac GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-0.12.1-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/))
|
||||||
* [Android](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-android/TF_BUILD_CONTAINER_TYPE=ANDROID,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=NO_PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=android-slave/lastSuccessfulBuild/artifact/bazel-out/local_linux/bin/tensorflow/examples/android/tensorflow_demo.apk) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-android/TF_BUILD_CONTAINER_TYPE=ANDROID,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=NO_PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=android-slave/))
|
* Android: [demo APK](https://ci.tensorflow.org/view/Nightly/job/nightly-android/lastSuccessfulBuild/artifact/out/tensorflow_demo.apk), [native libs](http://ci.tensorflow.org/view/Nightly/job/nightly-android/lastSuccessfulBuild/artifact/out/native/)
|
||||||
|
([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-android/))
|
||||||
|
|
||||||
#### *Try your first TensorFlow program*
|
#### *Try your first TensorFlow program*
|
||||||
```shell
|
```shell
|
||||||
|
@ -15,7 +15,7 @@ Android app. Note that training is not supported through this interface; for
|
|||||||
that you will have to use one of the other APIs.
|
that you will have to use one of the other APIs.
|
||||||
|
|
||||||
For prebuilt libraries, see the
|
For prebuilt libraries, see the
|
||||||
[nightly Android build artifacts](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-android/TF_BUILD_CONTAINER_TYPE=ANDROID,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=NO_PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=android-slave/)
|
[nightly Android build artifacts](https://ci.tensorflow.org/view/Nightly/job/nightly-android/)
|
||||||
page for a recent build.
|
page for a recent build.
|
||||||
|
|
||||||
To build the inference libraries yourself (if, for example, you want to support
|
To build the inference libraries yourself (if, for example, you want to support
|
||||||
|
@ -12,7 +12,7 @@ Inference is done using the [TensorFlow Android Inference Interface](../../../te
|
|||||||
which may be built separately if you want a standalone library to drop into your
|
which may be built separately if you want a standalone library to drop into your
|
||||||
existing application.
|
existing application.
|
||||||
|
|
||||||
# Current samples:
|
## Current samples:
|
||||||
|
|
||||||
1. [TF Classify](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/ClassifierActivity.java):
|
1. [TF Classify](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/ClassifierActivity.java):
|
||||||
Uses the [Google Inception](https://arxiv.org/abs/1409.4842)
|
Uses the [Google Inception](https://arxiv.org/abs/1409.4842)
|
||||||
@ -26,7 +26,8 @@ existing application.
|
|||||||
## Prebuilt APK:
|
## Prebuilt APK:
|
||||||
|
|
||||||
If you just want the fastest path to trying the demo, you may download the
|
If you just want the fastest path to trying the demo, you may download the
|
||||||
nightly build [here](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-android/TF_BUILD_CONTAINER_TYPE=ANDROID,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=NO_PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=android-slave/).
|
nightly build
|
||||||
|
[here](https://ci.tensorflow.org/view/Nightly/job/nightly-android/).
|
||||||
A device running Android 5.0 (API 21) or higher is required.
|
A device running Android 5.0 (API 21) or higher is required.
|
||||||
|
|
||||||
## Running the Demo
|
## Running the Demo
|
||||||
@ -40,22 +41,36 @@ that may be useful for development purposes.
|
|||||||
|
|
||||||
## Building the Demo from Source
|
## Building the Demo from Source
|
||||||
|
|
||||||
### Install Bazel and Android Prerquisites
|
Pick your preferred approach below. At the moment, we have full support for
|
||||||
|
Bazel, and partial support for gradle, cmake, make, and Android Studio.
|
||||||
|
|
||||||
|
As a first step for all build types, clone the TensorFlow repo with:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone --recurse-submodules https://github.com/tensorflow/tensorflow.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that `--recurse-submodules` is necessary to prevent some issues with
|
||||||
|
protobuf compilation.
|
||||||
|
|
||||||
|
### Bazel
|
||||||
|
|
||||||
|
##### Install Bazel and Android Prerequisites
|
||||||
|
|
||||||
Bazel is the primary build system for TensorFlow. To build with Bazel,
|
Bazel is the primary build system for TensorFlow. To build with Bazel,
|
||||||
it and the Android NDK and SDK must be installed on your system.
|
it and the Android NDK and SDK must be installed on your system.
|
||||||
|
|
||||||
1. Get the recommended Bazel version listed at:
|
1. Get the recommended Bazel version listed in [os_setup.html](https://www.tensorflow.org/versions/master/get_started/os_setup.html#source)
|
||||||
https://www.tensorflow.org/versions/master/get_started/os_setup.html#source
|
|
||||||
2. The Android NDK is required to build the native (C/C++) TensorFlow code.
|
2. The Android NDK is required to build the native (C/C++) TensorFlow code.
|
||||||
The current recommended version is 12b, which may be found
|
The current recommended version is 12b, which may be found
|
||||||
[here](https://developer.android.com/ndk/downloads/older_releases.html#ndk-12b-downloads).
|
[here](https://developer.android.com/ndk/downloads/older_releases.html#ndk-12b-downloads).
|
||||||
3. The Android SDK and build tools may be obtained from:
|
3. The Android SDK and build tools may be obtained
|
||||||
https://developer.android.com/tools/revisions/build-tools.html
|
[here](https://developer.android.com/tools/revisions/build-tools.html),
|
||||||
The SDK also comes packaged with Android Studio, if you have that
|
or alternatively as part of
|
||||||
installed.
|
[Android Studio](https://developer.android.com/studio/index.html). Build
|
||||||
|
tools API >= 23 is required to build the TF Android demo.
|
||||||
|
|
||||||
#### Edit WORKSPACE
|
##### Edit WORKSPACE
|
||||||
|
|
||||||
The Android entries in [`<workspace_root>/WORKSPACE`](../../../WORKSPACE#L2-L13)
|
The Android entries in [`<workspace_root>/WORKSPACE`](../../../WORKSPACE#L2-L13)
|
||||||
must be uncommented with the paths filled in appropriately depending on where
|
must be uncommented with the paths filled in appropriately depending on where
|
||||||
@ -68,7 +83,7 @@ have installed in your SDK. This must be >= 23 (this is completely independent
|
|||||||
of the API level of the demo, which is defined in AndroidManifest.xml).
|
of the API level of the demo, which is defined in AndroidManifest.xml).
|
||||||
The NDK API level may remain at 21.
|
The NDK API level may remain at 21.
|
||||||
|
|
||||||
#### Install Model Files (optional)
|
##### Install Model Files (optional)
|
||||||
|
|
||||||
The TensorFlow `GraphDef`s that contain the model definitions and weights
|
The TensorFlow `GraphDef`s that contain the model definitions and weights
|
||||||
are not packaged in the repo because of their size. They are downloaded
|
are not packaged in the repo because of their size. They are downloaded
|
||||||
@ -91,11 +106,11 @@ $ unzip /tmp/mobile_multibox_v1.zip -d tensorflow/examples/android/assets/
|
|||||||
This will extract the models and their associated metadata files to the local
|
This will extract the models and their associated metadata files to the local
|
||||||
assets/ directory.
|
assets/ directory.
|
||||||
|
|
||||||
|
##### Build
|
||||||
|
|
||||||
After editing your WORKSPACE file to update the SDK/NDK configuration,
|
After editing your WORKSPACE file to update the SDK/NDK configuration,
|
||||||
you may build the APK. Run this from your workspace root:
|
you may build the APK. Run this from your workspace root:
|
||||||
|
|
||||||
#### Build
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ bazel build -c opt //tensorflow/examples/android:tensorflow_demo
|
$ bazel build -c opt //tensorflow/examples/android:tensorflow_demo
|
||||||
```
|
```
|
||||||
@ -104,7 +119,7 @@ If you get build errors about protocol buffers, run
|
|||||||
`git submodule update --init` and make sure that you've modified your WORKSPACE
|
`git submodule update --init` and make sure that you've modified your WORKSPACE
|
||||||
file as instructed, then try building again.
|
file as instructed, then try building again.
|
||||||
|
|
||||||
#### Install
|
##### Install
|
||||||
|
|
||||||
Make sure that adb debugging is enabled on your Android 5.0 (API 21) or
|
Make sure that adb debugging is enabled on your Android 5.0 (API 21) or
|
||||||
later device, then after building use the following command from your workspace
|
later device, then after building use the following command from your workspace
|
||||||
@ -118,7 +133,7 @@ $ adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk
|
|||||||
|
|
||||||
Android Studio may be used to build the demo in conjunction with Bazel. First,
|
Android Studio may be used to build the demo in conjunction with Bazel. First,
|
||||||
make sure that you can build with Bazel following the above directions. Then,
|
make sure that you can build with Bazel following the above directions. Then,
|
||||||
look at (build.gradle)[build.gradle] and make sure that the path to Bazel
|
look at [build.gradle](build.gradle) and make sure that the path to Bazel
|
||||||
matches that of your system.
|
matches that of your system.
|
||||||
|
|
||||||
At this point you can add the tensorflow/examples/android directory as a new
|
At this point you can add the tensorflow/examples/android directory as a new
|
||||||
|
Loading…
Reference in New Issue
Block a user