Tensorflow has very good example how to use pretrained model with Android devices. https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android
Only choose Your machine environment and demo example will be installed.
I have Android Studio with standart Gradle project. Thats why need only copy this folder (/tensorflow/examples/android) from tensorflow github batch to my folder with Android workspaces. after tha need to open my new workspace and gradle install and load all dependencies to folder.
You need to paste this strings to build.gradle file:
allprojects {
repositories { jcenter() }
}
dependencies {
compile 'org.tensorflow:tensorflow-android:+'
}
After firts time running program I have recieved some problem with loading imagenet_comp_graph_string.txt label file.
Do not know why but I have such wrong variable assignment in ClassifierActivity.java file
You need only delete spaces and crlf
all works like miracle with this tensorflow pretrained graph!