Tensorflow。在训练模式下评估模型上的单个图像

时间:2018-09-11 11:04:36

标签: python tensorflow

我尝试评估由MMDnn转换为张量流的模型,它只有TRAINING模式。代码是:

import tensorflow as tf
import numpy as np

export_dir = 'model/'
with tf.Session(graph=tf.Graph()) as sess:
    tf.saved_model.loader.load(sess, [tf.saved_model.tag_constants.TRAINING], export_dir)
    x = np.random.rand(1,256,256,3)
    tensor_input = sess.graph.get_tensor_by_name('data:0')
    tensor_output = sess.graph.get_tensor_by_name('convolution_73:0')
    preds = sess.run(tensor_output, {tensor_input: x})

但是我有错误:

InvalidArgumentError (see above for traceback): Conv2DSlowBackpropInput:     Size of out_backprop doesn't match computed: actual = 18, computed = 15spatial_dim: 2 input: 32 filter: 4 output: 18 stride: 2 dilation: 1

就像tf尝试训练模型而不是评估。有什么办法可以评估这个模型? 我不需要反向支撑,只需向前迈进。

0 个答案:

没有答案
相关问题