diff --git a/tensorflow/examples/android/README.md b/tensorflow/examples/android/README.md index fbbe9f276bc..d2e48450529 100644 --- a/tensorflow/examples/android/README.md +++ b/tensorflow/examples/android/README.md @@ -12,6 +12,8 @@ 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 existing application. +A device running Android 5.0 (API 21) or higher is required to run the demo. + ## Current samples: 1. [TF Classify](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/ClassifierActivity.java): @@ -27,17 +29,25 @@ existing application. (https://arxiv.org/abs/1610.07629) to restyle the camera preview image to that of a number of different artists. + + + + ## Prebuilt APK: 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-android/). -A device running Android 5.0 (API 21) or higher is required. +[here](https://ci.tensorflow.org/view/Nightly/job/nightly-android/). Expand the +"View" and then the "out" folders under "Last Successful Artifacts to find +tensorflow_demo.apk. Also available are precompiled native libraries that you +may drop into your own applications. See +[tensorflow/contrib/android/README.md](../../../tensorflow/contrib/android/README.md) +for more details. ## Running the Demo -Once the app is installed it can be started via the "TF Classify" and -"TF Detect" and icons, which have the orange TensorFlow logo as their icon. +Once the app is installed it can be started via the "TF Classify", "TF Detect" +and "TF Stylize" icons, which have the orange TensorFlow logo as their icon. While running the activities, pressing the volume keys on your device will toggle debug visualizations on/off, rendering additional info to the screen @@ -92,19 +102,20 @@ The NDK API level may remain at 21. The TensorFlow `GraphDef`s that contain the model definitions and weights are not packaged in the repo because of their size. They are downloaded automatically and packaged with the APK by Bazel via a new_http_archive defined -in WORKSPACE during the build process. +in `WORKSPACE` during the build process. **Optional**: If you wish to place the models in your assets manually (E.g. for -non-Bazel builds), remove the `inception_5` and `mobile_multibox` entries in -`BUILD` and download the archives yourself to the `assets` directory in the -source tree: +non-Bazel builds), remove all of the `model_files` entries from the `assets` +list in `tensorflow_demo` found in the `[BUILD](BUILD)` file. Then download +and extract the archives yourself to the `assets` directory in thesource tree: ```bash -$ curl -L https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip -o /tmp/inception5h.zip -$ curl -L https://storage.googleapis.com/download.tensorflow.org/models/mobile_multibox_v1.zip -o /tmp/mobile_multibox_v1.zip - -$ unzip /tmp/inception5h.zip -d tensorflow/examples/android/assets/ -$ unzip /tmp/mobile_multibox_v1.zip -d tensorflow/examples/android/assets/ +BASE_URL=https://storage.googleapis.com/download.tensorflow.org/models +for MODEL_ZIP in inception5h.zip mobile_multibox_v1a.zip stylize_v1.zip +do + curl -L ${BASE_URL}/${MODEL_ZIP} -o /tmp/${MODEL_ZIP} + unzip /tmp/${MODEL_ZIP} -d tensorflow/examples/android/assets/ +done ``` This will extract the models and their associated metadata files to the local @@ -116,7 +127,7 @@ After editing your WORKSPACE file to update the SDK/NDK configuration, you may build the APK. Run this from your workspace root: ```bash -$ bazel build -c opt //tensorflow/examples/android:tensorflow_demo +bazel build -c opt //tensorflow/examples/android:tensorflow_demo ``` If you get build errors about protocol buffers, run @@ -130,7 +141,7 @@ later device, then after building use the following command from your workspace root to install the APK: ```bash -$ adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk +adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk ``` ### Android Studio