Skip to content Skip to sidebar Skip to footer

TensorFlowInferenceInterface: Mobilenet For Imagenet : Java.io.IOException: Not A Valid TensorFlow Graph Serialization

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

Solution 1:

The above issue has been resolved by updating the "libandroid_tensorflow_inference_java.jar" and "libtensorflow_inference.so" to the latest version i.e. Tensorflow - 1.4. The latest ".jar" and ".so" files can be found here.

The issue was due to mismatch of Tensorflow versions. Mobilenet classifier trained over ImageNet was built on Tensorflow - 1.3 and was being used for inference on Android with Tensorflow - 1.1.


Solution 2:

It says here in main activity java file

private static final String MODEL_FILE = "file:///android_asset/expert-graph.pb";
private static final String LABEL_FILE = "file:///android_asset/labels.txt";

Where your model files seems to be "mobilenet_imagenet.pb". After you make sure your model and labels name match for the project file here, change the input size what you trained on.(retrain.py file maybe has this information.)

private static final int INPUT_SIZE = 160;//
private static final int IMAGE_MEAN = 128;
private static final float IMAGE_STD = 128;
private static final String OUTPUT_NAME = "final_result";

Post a Comment for "TensorFlowInferenceInterface: Mobilenet For Imagenet : Java.io.IOException: Not A Valid TensorFlow Graph Serialization"