0

I want to make a local prediction on a saved model which is trained with the ML Engine. For my CNN Model, I'm using the sample code of the flower dataset (https://github.com/GoogleCloudPlatform/cloudml-samples/tree/master/flowers).

I have the following files: enter image description here

How to restore my model and make a prediction which return a list or dict with the accuracy scores?

I already tried to restore my model but it didn't work out.

import tensorflow as tf

with tf.Session() as sess:    
    saver = tf.train.import_meta_graph('saved_model.pb')
    saver.restore(sess,tf.train.latest_checkpoint('variables/'))
    print(sess.run('w1:0'))

Note 1: My goal is to make a classification report or/and confusion matrix just like we have in Keras.

Note 2: My model consists of 87 labels.

Note 3: Already accessed prediction scores with the Online Prediction API of ML Engine.

Jacob Verschaeve
  • 159
  • 2
  • 10
  • Why did restoring your model not work? – sdcbr Aug 21 '18 at 13:37
  • Complete error: Use the 'bytes' type if you intend to send raw bytes. saver = tf.train.import_meta_graph('saved_model.pb') File "/Library/Fra***3.5/site-packages/tensorflow/python/training/saver.py", line 1920, in import_meta_graph meta_graph_def = meta_graph.read_meta_graph_file(meta_graph_or_file) File "/Library****b/python3.5/site-packages/tensorflow/python/framework/meta_graph.py", line 643, in read_meta_graph_file text_format.Merge(file_content.decode("utf-8"), meta_graph_def) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 3: invalid start byte – Jacob Verschaeve Aug 21 '18 at 13:46
  • I think you'll find the answer here: https://stackoverflow.com/a/46139198/1399222 – rhaertel80 Aug 21 '18 at 14:12

0 Answers0