2017-10-23 12:19:28
0
I am trying to run mobilenet model trained over imagenet on Android Tensorflow for object recognition and facing the issue as described below.
TensorFlowInferenceInterface: Failed to load model
from 'file:///android_asset/mobilenet_imagenet.pb': java.io.IOException:
Not a valid TensorFlow Graph serialization:
NodeDef mentions attr 'data_format' not in Op
signature=input:T, filter:T -> output:T;
attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE]; attr=strides:list(int);
attr=padding:string,allowed=["SAME", "VALID"]>;
NodeDef: conv_dw_1/depthwise =
DepthwiseConv2dNative[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1]]
(conv1_relu/clip_by_value, conv_dw_1/depthwise_kernel/read)
I followed the tutorial as given in the link to integrate Tensorflow on Android. I could run basic CNN classifier custom trained (using python 2.7.12, Tensorflow 1.2 on Ubuntu 16.04)and it is working fine.
I could successfully run Mobilenet trained over imagenet on python 2.7.12 on Ubuntu 16.04 using Tensorflow 1.2 and 1.3. Now when I try to run the same '.pb' model on Android it gives me the error as mentioned above.
The code for initializing the model is as given below :
TensorFlowImageClassifier c = new TensorFlowImageClassifier();
c.inferenceInterface = new TensorFlowInferenceInterface();
if (c.inferenceInterface.initializeTensorFlow(assetManager, modelFilename) != 0) {
throw new RuntimeException("TF initialization failed");
}
Please provide me a solution or a work around