0
我正好具有this问题:如何从PredictResponse对象获取float_val?
运行在tensorflow-服务模型的预测后,我又回到这个PredictResponse对象作为输出:
outputs {
key: "scores"
value {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 1
}
dim {
size: 2
}
}
float_val: 0.407728463411
float_val: 0.592271506786
}
}
至于建议中的这个问题,我。尝试使用: result.outputs [ '输出'] float_val
但然后它返回类型<type google.protobuf.pyext._message.RepeatedScalarContainer>
它是由该p产生代码的灵感来自inception_client.py例如:
channel = implementations.insecure_channel(host, int(port))
stub = prediction_service_pb2.beta_create_PredictionService_stub(channel)
result = stub.Predict(request, 10.0) # 10 secs timeout
在此先感谢!
谢谢!我编辑它,因为我不得不使用result.outputs ['scores']。float_val [0]'而不是'result.outputs ['outputs']。float_val [0]' '钥匙'说'分数'。 –