rude-carnie icon indicating copy to clipboard operation
rude-carnie copied to clipboard

How to restore a model for android

Open YCG09 opened this issue 6 years ago • 1 comments

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!

YCG09 avatar Jul 14 '17 03:07 YCG09

几百M的模型能加载进去吗???手机不会黑屏、闪退?

ucasiggcas avatar Nov 27 '19 13:11 ucasiggcas