【问题标题】:"Request payload size exceeds the limit" in google cloud json prediction request谷歌云 json 预测请求中的“请求有效负载大小超出限制”
【发布时间】:2019-08-19 00:45:37
【问题描述】:

我正在尝试使用 google cloud ml 引擎进行预测。我使用fast-style-transfer 生成了我的模型,并将其保存在我的 google cloud ml 引擎的模型部分。对于输入,它使用 float32,所以我必须以这种格式转换我的图像。

image = tf.image.convert_image_dtype(im, dtypes.float32)
matrix_test = image.eval()

然后我为请求生成了我的 json 文件:

js = json.dumps({"image": matrix_test.tolist()})

使用以下代码:

gcloud ml-engine predict --model {model-name} --json-instances request.json

返回如下错误:

ERROR: (gcloud.ml-engine.predict) HTTP request failed. Response: {
  "error": {
    "code": 400,
    "message": "Request payload size exceeds the limit: 1572864 bytes.",
    "status": "INVALID_ARGUMENT"
  }
} 

我想知道我是否可以增加此限制,如果不能,是否有办法通过变通方法解决它...提前致谢!

【问题讨论】:

    标签: python-2.7 tensorflow google-cloud-ml


    【解决方案1】:

    这是 Cloud Machine Learning Engine API 的硬性限制。有一个feature request 来增加这个限制。您可以在那里发表评论,要求更新。此外,您可以同时尝试the following solution。

    希望对你有帮助

    【讨论】:

      【解决方案2】:

      如果您使用批量预测,您可以对超出该限制的图像进行预测。

      这是官方文档:https://cloud.google.com/ml-engine/docs/tensorflow/batch-predict

      我希望这对您有所帮助!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-04-23
        • 2019-08-10
        • 2019-12-28
        • 1970-01-01
        • 2018-02-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多