rude-carnie
rude-carnie copied to clipboard
How to restore a model for android
Hello!
Thanks for your excellent work.
I want to restore a pb model to support for android like this:
output_graph_def = graph_util.convert_variables_to_constants(session, session.graph_def,output_node_names=['output']) with tf.gfile.FastGFile('model/model.pb', mode='wb') as f: f.write(output_graph_def.SerializeToString())
Moreover, I have to get the name of input tensor and output like this:
private static final String inputName = "input"; private static final String outputName = "output"; TensorFlowInferenceInterface inferenceInterface; inferenceInterface.feed(inputName, inputs, WIDTH, HEIGHT); inferenceInterface.fetch(outputName, outputs);
But I couldn't find the input tensor name, is the line below the place I should modify? I am not sure..
images, labels, _ = distorted_inputs(FLAGS.train_dir, FLAGS.batch_size, FLAGS.image_size, FLAGS.num_preprocess_threads)
Would you please give me some advice? Thank you!
几百M的模型能加载进去吗???手机不会黑屏、闪退?