首页 > 解决方案 > 使用 AutoML 对象检测接收到的 JSON 负载无效

问题描述

尝试在对象检测 AutoML 快速入门中运行沙拉示例时,出现错误。成功创建数据集后,我运行 curl 命令导入数据:

curl -X POST -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" https://automl.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/us-central1/datasets/${DATASET}:importData -d '{
  "input_config": {
    "gcs_source": {
       "input_uris": [
         "gs://cloud-ml-data/img/openimage/csv/salads_ml_use.csv"
        ]
    }
  }

但我得到了错误

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Expected an object key or }.\n  \"input_config\": {\n^",
    "status": "INVALID_ARGUMENT"
  }
}

有任何想法吗?我尝试将其更改input_configinputConfig但无济于事。

标签: google-cloud-platformgoogle-cloud-automl

解决方案


您没有使用'关闭有效负载

应该是这样的

curl -X POST -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" https://automl.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/us-central1/datasets/${DATASET}:importData -d '{
  "input_config": {
    "gcs_source": {
       "input_uris": [
         "gs://cloud-ml-data/img/openimage/csv/salads_ml_use.csv"
        ]
    }
  }'

推荐阅读