Closed ycrjycm closed 6 years ago
Hi,
If I want to load an image and get its softmax score, How to write the script? I've been trying several hours, since I'm a beginner in tensorflow and it's kind diffcult for me.
with tf.Graph().as_default(): image = tf.cast(image_arr, tf.float32) image = tf.image.per_image_standardization(image) image = tf.reshape(image, [1,28, 28, 1]) #x = tf.placeholder(tf.float32,shape = [1,28, 28, 1]) feature=CapsNet.test_net(image) logits = tf.nn.softmax(feature) #saver = tf.train.Saver() aaa=1 with tf.Session() as sess: saver = tf.train.import_meta_graph('./logdir/model_epoch_0048_step_23899.meta') saver.restore(sess, './logdir/model_epoch_0048_step_23899') print(image.shape) test_result = sess.run(aaa,image)
Hi,
If I want to load an image and get its softmax score, How to write the script? I've been trying several hours, since I'm a beginner in tensorflow and it's kind diffcult for me.