Tensorflow保存模型的数据输入JSON格式

时间:2020-06-01 00:21:30

标签: json google-cloud-platform tensorflow2.0 prediction google-cloud-ai

我是tensorflow的新手,我已将保存的模型提供给Google AI平台模型。但是,样本输入数据的格式存在问题。您能否指导我如何根据以下要求的格式来格式化数据输入?预先感谢。

要请求在线预测,需要按如下所示将数据实例作为JSON对象输入。

{
  "instances": [
    <value>|<simple/nested list>|<object>,
    ...
  ]
}
下面的

是$ saved_model_cli --dir路径/ home /。的输出的一部分。--all 总之,我有12个数据输入作为字符串值。如何将以上请求格式放在一起,以便模型可以返回预测?谢谢!

Defined Functions:
  Function Name: '__call__'
    Option #1
      Callable with:
        Argument #1
          DType: list
          Value: [TensorSpec(shape=(None, 3), dtype=tf.float32, name='a_xf'), TensorSpec(shape=(None, 2), dtype=tf.float32, name='b_xf'), TensorSpec(shape=(None, 8), dtype=tf.float32, name='c_xf'), TensorSpec(shape=(None, 12), dtype=tf.float32, name='d_xf'), TensorSpec(shape=(None, 4), dtype=tf.float32, name='e_xf'), TensorSpec(shape=(None, 16), dtype=tf.float32, name='f_xf'), TensorSpec(shape=(None, 26), dtype=tf.float32, name='g_xf'), TensorSpec(shape=(None, 4), dtype=tf.float32, name='h_xf'), TensorSpec(shape=(None, 2), dtype=tf.float32, name='i_xf'), TensorSpec(shape=(None, 11), dtype=tf.float32, name='j_xf'), TensorSpec(shape=(None, 6), dtype=tf.float32, name='k_xf'), TensorSpec(shape=(None, 2), dtype=tf.float32, name='l_xf')]
        Argument #2
          DType: bool
          Value: False
        Argument #3
          DType: NoneType
          Value: None

0 个答案:

没有答案