Issue 1:
It's a great step to support importing Android lib via jcenter. However, I'm having trouble in loading pretrained models into TensorFlowInferenceInterface, which says NodeDef mentions attr 'dilations' not in Op.... I think it's a compatibility issue, meaning that the model graph is not consistent with the graph interpreter. The models directly downloaded from slim and frozen by myself. Anyone can help me?

Issue 2:
Please go to Stack Overflow for help and support:

https://stackoverflow.com/questions/tagged/tensorflow

If you open a GitHub issue, here is our policy:

It must be a bug or a feature request.

The form below must be filled out.

It shouldn't be a TensorBoard issue. Those go here.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow):

no

OS Platform and Distribution (e.g., Linux Ubuntu 16.04):

Linux Ubuntu 16.04

TensorFlow installed from (source or binary):

source

TensorFlow version (use command below):

('v1.3.0-rc1-5733-gb43d0f3', '1.4.0')

Python version:

2.7.12

Bazel version (if compiling from source):

0.9.0

GCC/Compiler version (if compiling from source):

5.4.0

CUDA/cuDNN version:

GPU model and memory:

Exact command to reproduce:

I have retrained a mobilenet_v1_1.0_224 frozen_graph.pb model with the following script:

export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages

export IMAGE_SIZE=224

export WIDTH_MUL=1.0 # 0.75 0.50 0.25

export ARCHITECTURE="mobilenet_${WIDTH_MUL}_${IMAGE_SIZE}"

export BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

export TF_FILES_DIR="tf_files"

python -m scripts.retrain

--bottleneck_dir="${TF_FILES_DIR}"/bottlenecks

--how_many_training_steps=4000

--model_dir="${TF_FILES_DIR}"/models/

--summaries_dir="${TF_FILES_DIR}"/training_summaries/"${ARCHITECTURE}"

--output_graph="${TF_FILES_DIR}"/retrained_graph.pb

--output_labels="${TF_FILES_DIR}"/retrained_labels.txt

--architecture="${ARCHITECTURE}"

--image_dir="${TF_FILES_DIR}"/flower_photos

I copied "retrained_graph.pb" and "retrained_labels.txt" in the "assets" directory of the android demo app in tensorflow/examples/android and modified the source code in ClassifierActivity.java as follows:

/* Original code:

private static final String INPUT_NAME = "input";

private static final String OUTPUT_NAME = "output";

private static final String MODEL_FILE = "file:///android_asset/tensorflow_inception_graph.pb";

private static final String LABEL_FILE = "file:///android_asset/imagenet_comp_graph_label_strings.txt";

/

/ Replaced by: /

private static final String INPUT_NAME = "input";

private static final String OUTPUT_NAME = "final_result";

private static final String MODEL_FILE = "file:///android_asset/retrained_graph.pb";

private static final String LABEL_FILE = "file:///android_asset/retrained_labels.txt";

/ End */

I cleaned and rebuilt the whole project in Android Studio, successfully.

The app was then loaded on a Huawei P8 Lite (Android 7.0) and starting TF Classify, the following error occurs:

E/tensorflow: CameraActivity: Exception!

java.lang.RuntimeException: Failed to load model from 'file:///android_asset/retrained_graph.pb'

at org.tensorflow.contrib.android.TensorFlowInferenceInterface.(TensorFlowInferenceInterface.java:113)

at org.tensorflow.demo.TensorFlowImageClassifier.create(TensorFlowImageClassifier.java:103)

at org.tensorflow.demo.ClassifierActivity.onPreviewSizeChosen(ClassifierActivity.java:118)

at org.tensorflow.demo.CameraActivity.onPreviewFrame(CameraActivity.java:120)

at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1204)

at android.os.Handler.dispatchMessage(Handler.java:105)

at android.os.Looper.loop(Looper.java:156)

at android.app.ActivityThread.main(ActivityThread.java:6523)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

Caused by: java.io.IOException: Not a valid TensorFlow Graph serialization: NodeDef mentions attr 'dilations' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: MobilenetV1/MobilenetV1/Conv2d_0/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](input, MobilenetV1/Conv2d_0/weights/read). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

at org.tensorflow.contrib.android.TensorFlowInferenceInterface.loadGraph(TensorFlowInferenceInterface.java:535)

at org.tensorflow.contrib.android.TensorFlowInferenceInterface.(TensorFlowInferenceInterface.java:105)

at org.tensorflow.demo.TensorFlowImageClassifier.create(TensorFlowImageClassifier.java:103)

at org.tensorflow.demo.ClassifierActivity.onPreviewSizeChosen(ClassifierActivity.java:118)

at org.tensorflow.demo.CameraActivity.onPreviewFrame(CameraActivity.java:120)

at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1204)

at android.os.Handler.dispatchMessage(Handler.java:105)

at android.os.Looper.loop(Looper.java:156)

at android.app.ActivityThread.main(ActivityThread.java:6523)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

Application terminated.

How to fix this error?