Using trained model utilzing inception_resnet_v1 in tensorflow android with TensorFlowInferenceInterface met the errors stated below, can anyone help advise how to solve?
TensorFlowInferenceInterface: Failed to run TensorFlow session: java.lang.IllegalArgumentException: You must feed a value for placeholder tensor 'phase_train' with dtype bool
[[Node: phase_train = Placeholder[dtype=DT_BOOL, shape=
Previously met errors stated here #238 and #348 and solved using solution stated at https://stackoverflow.com/a/43627334
and
adding "fifo_queue_op.cc" to tensorflow/core/kernals/BUILD at
filegroup(
name = "android_core_ops",
srcs = [.....
What you need is to modify the TensorFlowInferenceInterface to allow feeding a boolean to graph, that way you can assign a False to phase_train node.
If TensorFlow Android currently doesn't support Boolean data type, you also need to modify so that it allows boolean.
I have done this 3/4 months ago, back then I need to enable boolean for Android
public void feed(String inputName, boolean[] src, long... dims){
byte[] b = new byte[src.length];
for (int i = 0; i < src.length; i++) {
b[i] = src[i] ? (byte)1 : (byte)0;
}
addFeed(inputName, Tensor.create(DataType.BOOL,dims,ByteBuffer.wrap(b)));
}
added this to TensorFlowInferenceInterface and rebuild the .so and jar file, will test it when I have time.
Is inception_resnet_v1 model running in real time on Android platform? @JianbangZ
i want to know if you had fixed the problem,i am doing the same work,and how to feed the phase_train to session?loading the 20170512-110547.pb
I'm modifying TensorFlow Mobile Android example, and this works for me:
TensorFlowImageClassifier.java:153
// Copy the input data into TensorFlow.
Trace.beginSection("feed");
inferenceInterface.feed(inputName, floatValues, 1, inputSize, inputSize, 3);
inferenceInterface.feed("phase_train", new boolean[]{false});
Trace.endSection();
@Roger00 Our TensorFlowInferenceInterface don't support boolean type, Have you ever fix the inferenceInterface to support boolean data type?
Hi @Roger00
Could you share your working Android code?
Thank you very much!!
@Roger00 hi, I have the same question. I have tried a long time,but didn't solve. Could you share your working Android code? Thanks!!
If you are using https://github.com/pillarpond/face-recognizer-android app ..
then add this code in your FaceNet.java file at line: 147
inferenceInterface.feed("phase_train", new boolean[]{false});
Most helpful comment
I'm modifying TensorFlow Mobile Android example, and this works for me:
TensorFlowImageClassifier.java:153