Tensorflow服务:无法解析示例输入

时间:2018-08-16 00:51:56

标签: tensorflow tensorflow-serving

我在保存模型和客户端文件中使用了与初始示例相同的代码。

 serialized_tf_example = tf.placeholder(tf.string, name='tf_example')
 feature_configs = {
            'image/encoded': tf.FixedLenSequenceFeature(
                shape=[], dtype=tf.string),
        }
 tf_example = tf.parse_example(serialized_tf_example, feature_configs)
 jpegs = tf_example['image/encoded']
 images = tf.map_fn(preprocess_image, jpegs, dtype=tf.float32)

def main(_):
  host, port = FLAGS.server.split(':')
  channel = implementations.insecure_channel(host, int(port))
  stub = prediction_service_pb2.beta_create_PredictionService_stub(channel)
  # Send request
  with open(FLAGS.image,'rb') as f:
    # See prediction_service.proto for gRPC request/response details.
    data = f.read()

    request = predict_pb2.PredictRequest()
    request.model_spec.name = 'inception'
    request.model_spec.signature_name = tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY
    request.inputs['input'].CopyFrom(
         tf.contrib.util.make_tensor_proto([data], shape=[1]))
    result = stub.Predict(request, 10.0)  # 10 secs timeout
    print(result)

我在客户端出现AbortionError:

grpc.framework.interfaces.face.face.AbortionError: AbortionError(code=StatusCode.INVALID_ARGUMENT, details="Could not parse example

,服务器中的错误是:

OP_REQUIRES failed at example_parsing_ops.cc:144 : Invalid argument: Could not parse example input, value: '����

任何人都可以帮忙吗?

0 个答案:

没有答案