标记识别器指南

Tag Recognizer 模型可帮助您解决了解零售货架的关键问题,即根据用户定义的键值对实体提取架构识别和解析标签(例如价格标签或其他标签)。

此模型可作为主要的 AI 基础组件,用于分析和解读零售店中的商品图片数据。例如,您可以对本地摄像头或移动设备拍摄的货架图片使用此模型。

标记识别器和商品识别器用例

商品识别器和标签识别器模型可以作为主要的 AI 基础组件,用于分析和解读您可能从零售店捕获的商品和标签图片数据。

商品识别器和价签识别器模型融合了多项核心 Google AI 建模和数据功能,可帮助零售商和/或技术合作伙伴解决理解商品和价签图片数据方面的关键问题,包括:

  • 识别,即了解图片中的商品。
  • 根据用户定义的键值对实体提取架构识别和解析标签(例如价格标签或任何其他文本标签)。

具体而言,其中包含多个具有差异化优势的 Google AI 模型,可支持这些应用场景的问题解决,例如

  • 商品缩略图视觉嵌入模型,可将商品缩略图转换为数字特征空间表示。
  • Google OCR 模型,可提取图片中显示的所有文本。
  • Google 实体提取模型(可自定义),可将原始文本转换为用户定义的键值对命名实体。

除了这些 Google AI 模型之外,商品识别器还利用了 Google 的大型商品信息数据库。此商品数据库中的商品数据包括商品的 GTIN/UPC 标识、商品品牌、商品名和跨语言说明、商品徽标以及各种包装变体的图片。借助上述商品缩略图视觉嵌入模型,商品数据库可让商品识别器模型立即识别许多商品。

两大 AI 功能分别是商品识别器和标签识别器模型。

标记识别器功能

此模型会识别标签中的所有文本字符串,然后尝试将文本解析为用户定义的键值对实体提取架构,例如商品项说明或价格值。它包含以下差异化的 Google AI 模型:

  • Google OCR 技术,可提取图片中的所有可见文本。
  • Google 实体提取模型,可将原始文本转换为用户定义的键值对命名实体。使用 Vertex AI 自定义此模型。例如,如果您主要关注商品说明、商品价格值或促销价,而不关注其他内容,则可以按如下方式定义标记解析架构:

    key: item_description   value: string
    key: regular_price      value: number
    key: sale_price         value: number
    

代码解析架构

通过自定义实体提取模型训练,系统随后将根据用户定义的架构识别和解析检测到的标签项框,例如:

  item_description:   COLLECTION 18PC GFT BX
  regular_price:      1099
  sale_price:         999

输出 JSON 对象示例

{
  "imageUri": "gs://test_bucket/test_image.jpg",
  "tagRecognitionAnnotations": [
    {
      "entities": [
        {
          "confidence": 0.99646133,
          "mentionText": "NISSIN TOP RAMEN\n\nBOW CHICKEN\n\n",
          "region": {
            "xMax": 0.4618055,
            "xMin": 0.042725038,
            "yMax": 0.45387268,
            "yMin": 0.18415153
          },
          "type":"description"
        },
        {
          "confidence": 0.95828205,
          "mentionText": "$3.90\n",
          "region": {
            "xMax": 0.24819264,
            "xMin": 0.04185935,
            "yMax": 0.96134734,
            "yMin": 0.80382305
          },
          "type":"unit_price"
        },
        {
          "confidence": 0.60659707,
          "mentionText": "$14.99\n",
          "region": {
            "xMax": 0.9754113,
            "xMin": 0.3654699,
            "yMax": 0.92825794,
            "yMin": 0.40368474
          },
          "type":"price"
        }
      ]
    }
  ]
}

环境设置

本部分介绍了如何与 Store Vision AI RESTful API 进行交互。

API_ENDPOINT=visionai.googleapis.com
PROJECT_ID=your project ID

所有 create 方法都需要明确指定要创建的资源名称/ID。您可以使用有意义的字符串标识符(例如“product-ABC”)或随机生成的标识符(例如 UUID)。

如需向某个角色授予使用 Store Vision API 的编辑者权限,请运行以下 IAM 绑定命令:

gcloud projects add-iam-policy-binding PROJECT_ID --member='user:USER_ACCOUNT' --role='roles/visionai.editor'

如需向服务账号授予编辑权限,请使用以下命令:

gcloud projects add-iam-policy-binding PROJECT_ID --member='serviceAccount:SERVICE_ACCOUNT' --role='roles/visionai.editor'

详细了解 IAM 绑定。

标记识别器用户体验历程

  1. 使用 Vertex AI/AutoML Vision 对象检测功能执行标签检测模型自定义训练。
  2. 使用 Vertex AI/AutoML Vision 对象检测功能和自定义 OCR 引擎执行标记实体解析模型训练。
  3. 使用所需的标签识别配置创建端点。
  4. 使用 TagRecognition 功能执行 BatchAnalyze。在后端,系统会识别每张输入图片中的标签,分析每个检测到的标签上的文本,以生成结构化解析输出。T ## 标签检测和实体解析模型训练

您可以使用我们现有的 Vertex AI/AutoML Vision 产品的图片对象检测模型训练功能来训练自定义标签检测模型。虽然 Vertex AI/AutoML Vision 对象检测模型训练功能提供了全代管式式模型训练体验,但您仍需负责准备一个样本充足的图片数据集,其中包含完全标注的对象边界框注释,作为训练数据集输入到模型训练控制台中。 Google Cloud 提供了 Vertex AI Data Labeling Service,可让您创建数据标注任务。如需了解详情,请点击以下 Vertex AI 数据标注作业链接:/vertex-ai/docs/datasets/data-labeling-job。向人工评分者提供清晰的数据标签添加说明,以便他们了解如何为图片中的标签检测边界框添加标签,作为训练数据集准备工作。

如需训练标签实体解析模型,您需要准备一组训练数据,其中包含图片及其关联的注释。

  • 该图片是已剪裁的标签图片。
  • 在每张图片中,您需要定义并提供要检测和识别/解析的关键实体字段(例如 product_title、price、unit_price 字段),以及这些字段在此剪裁图片视图中的关联图片边界框坐标位置。
  • 为了支持正确的识别/解析,我们还要求您提供正则表达式语法来描述每个字段。这是为了协助标记解析算法的训练和推理例程。

识别出的标签图片

标记实体解析训练样本

例如,对于前面的标记实体解析训练示例,您可以在训练数据注解 CSV 文件中提供一行注解信息,如下所示:

"image_filepath", "product_title", "(x0, y0, x1, y1)", "", "price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}", "unit_price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}"

在上述示例中:

  • “product_title”字段具有其对应的框图片坐标“(x0, y0, x1, y1)”,并且此字段的正则表达式限制条件为无“”。
  • “price”字段具有其对应的框图片坐标“(x0, y0, x1, y1)”,并且此字段的正则表达式限制条件为“\$\d+\.\d{2}”,这表示我们希望识别和解析此字段,其中文本条目开头为 $ 符号,“.”之前有几位数字,“.”之后有两位数字。
  • “unit_price”字段具有与“price”字段相同的注解语法,例如,框图片坐标“(x0, y0, x1, y1)”和此字段的正则表达式约束条件为“\$\d+\.\d{2}”,这表示我们希望在文本条目开头使用 $ 符号识别和解析此字段,并在“.”之前使用几个数字,在“.”之后使用两个数字。

因此,适当的价格标签解析/实体检测模型训练数据将包含一系列价格标签图片,并在 CSV 文件中添加注解,其中每个 CSV 行条目都与上一个示例中的条目类似。

"image_filepath", "product_title", "(x0, y0, x1, y1)", "", "price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}", "unit_price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}"

"image_filepath", "product_title", "(x0, y0, x1, y1)", "", "price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}", "unit_price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}"

"image_filepath", "product_title", "(x0, y0, x1, y1)", "", "price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}", "unit_price", "(x0, y0, x1, y1)", "\\$\\d+\\.\\d{2}"

[...]

您可以使用我们现有的 Vertex AI/AutoML Vision 产品的图片对象检测模型训练功能,以及 Google OCR 引擎自定义功能,来训练自定义的标签实体解析模型。

截至 2022 年 7 月,自定义商品标签检测和商品标签实体解析模型训练和部署到 Store Vision AI 的 BatchAnalyze API 尚未完全作为集成式控制台体验提供支持,您仍然可以利用此自定义商品标签检测和商品标签实体解析模型训练(使用 Agent Platform Vision 的对象检测功能),并通过执行几个手动自助服务步骤在 Store Vision AI 的 BatchAnalyze API 中提供这些模型。

API 用量 - 批量分析推理

创建端点
  • ENDPOINT_ID=您的端点 ID
  • TAG_DETECTOR=您的标记检测模型名称
  • TAG_PARSER=您的代码解析模型名称
curl -sS -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" https://visionai.googleapis.com/v1alpha1/projects/PROJECT_ID/locations/us-central1/retailEndpoints?retail_endpoint_id=ENDPOINT_ID \
-d '{
  "tagRecognitionConfig": {
    "tag_detection_model": "TAG_DETECTOR_NAME",
    "tag_parsing_model": "TAG_PARSER_NAME"
  }
}'
  • INPUT_FILE_URI=输入文件的 Cloud Storage URI,输入文件中的每一行都是要处理的图片的 Cloud Storage URI,例如 gs://my-bucket/my-image.jpg
  • OUTPUT_URI_PREFIX=输出结果文件的 Cloud Storage URI 前缀,例如 gs://my-bucket/my-output-dir
curl -sS -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" https://visionai.googleapis.com/v1alpha1/projects/PROJECT_ID/locations/us-central1/retailEndpoints/ENDPOINT_ID:batchAnalyze 
-d '{
  "gcsSource": {
    "uris": ["INPUT_FILE_URI"]
  },
  "features": [
    {
      "type": "TYPE_TAG_RECOGNITION",
     }
  ],
  "outputGcsDestination": {
    "outputUriPrefix": "OUTPUT_URI_PREFIX"
  }
}'
"features": [
    {
      "type": "TYPE_TAG_RECOGNITION",
      "tagRecognitionConfig": {
        "tag_detection_model": "'TAG_DETECTOR_NAME'",
        "tag_parsing_model": "TAG_PARSER_NAME"
      }
    }
  ],

您还可以在 tagRecognitionConfig(一个 RetailTagRecognitionConfig 对象)中设置和配置更多字段。如需了解详情,请参阅 API 参考文档中的资源说明。

API 参考文档

资源:projects.locations.retailCatalogs

JSON 表示法

{
  "name": string,
  "displayName": string,
  "createTime": string,
  "updateTime": string,
  "resourceState": enum(RetailResourceState),
  "labels": {
    string: string,
    ...
  }
}

字段


名称

字符串

仅限输出。RetailCatalog 的资源名称

displayName

字符串

可选。RetailCatalog 的显示名称。

createTime

字符串(时间戳格式)

仅限输出。此 RetailCatalog 的创建时间戳。

updateTime

字符串(时间戳格式)

仅限输出。更新时间戳。

resourceState

枚举

仅限输出。RetailCatalog 的状态。

个标签

映射(键:字符串,值:字符串)

带有用户定义元数据的标签,用于整理 RetailCatalog。

标签键和值不得超过 64 个字符(Unicode 代码点),并且只能包含小写字母、数字字符、下划线和短划线。允许使用国际字符。

如需了解详情和标签示例,请访问 https://goo.gl/xmQnxf。

包含 "key": value 对列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

方法:projects.locations.retailCatalogs.create

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/us-central1}/retailCatalogs

路径参数

父级 字符串 必需。父级标识符。

请求正文

请求正文包含一个 RetailCatalog 实例。

响应正文

如果成功,响应正文将包含一个新创建的 RetailCatalog 实例。

方法:projects.locations.retailCatalogs.get

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/us-central1/retailCatalogs/*}

路径参数

name 字符串 必需。RetailCatalog 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 RetailCatalog 实例。

方法:projects.locations.retailCatalogs.list

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/us-central1}/retailCatalogs

路径参数

父级 字符串 必需。父级标识符。

查询参数

filter 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize integer 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
orderBy string 可选。以逗号分隔列表形式表示的排序依据字段,按升序排列。在字段名称后添加“desc”表示降序。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含采用以下结构的数据: JSON 表示法

{
  "retailCatalogs": [
    {
      object (RetailCatalog)
    }
  ],
  "nextPageToken": string
}

方法:projects.locations.retailCatalogs.delete

HTTP 请求

DELETE https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/us-central1/retailCatalogs/*}

路径参数

name 字符串 必需。RetailCatalog 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

方法:projects.locations.retailCatalogs.importRetailProducts

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/us-central1/retailCatalogs/*}:importRetailProducts

路径参数

name 字符串 必需。RetailCatalog 资源名称。

请求正文

JSON 表示法

{
  "gcsSource": { object(GcsSource) },
  "format": enum(Format)
}

字段

gcsSource 对象 必需。输入内容所在的 Cloud Storage 位置。 您可以提供多个输入位置。所有输入位置的内容都将批量导入。支持的文件扩展名:1。 JSONL 文件。每行都是 RetailProductIoFormat 的 JSON 格式。
2. TXT 文件。每行都是要导入的商品的 GTIN。
格式 枚举 必需。导入文件格式。

设置枚举值的格式

FORMAT_UNSPECIFIED 不应使用。
FORMAT_TXT TXT 格式。
FORMAT_JSONL JSONL 格式。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

资源:projects.locations.retailProducts

JSON 表示法

{
  "name": string,
  "gtins": [string],
  "normalizedGtins": [string],
  "thirdPartyIds": [ { object(ThirdPartyId) }],
  "locale": string,
  "brand": string,
  "title": string,
  "productUri": string,
  "resourceState": enum(RetailResourceState),
   "labels": {
    string: string,
    ...
    }
   "createTime": string,
   "updateTime": string
}

字段


名称

字符串

仅限输出。RetailProductImage 的资源名称

displayName

字符串

可选。RetailProductImage 的显示名称。

sourceType

枚举

可选。来源类型

gcsUri

字符串

可选。RetailProductImage 的 Cloud Storage 位置。除非图片由 Google 提供(例如,当来源类型为 SOURCE_TYPE_GOOGLE 时),否则应设置此字段。

resourceState

枚举

仅限输出。RetailProductImage 的状态。

个标签

映射(键:字符串,值:字符串)

带有用户定义元数据的标签,用于整理 RetailProductImage。

标签键和值不得超过 64 个字符(Unicode 代码点),并且只能包含小写字母、数字字符、下划线和短划线。允许使用国际字符。

如需了解详情和标签示例,请访问 https://goo.gl/xmQnxf。

包含 "key": value 对列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字符串(时间戳格式)

仅限输出。创建时间戳。

updateTime

字符串(时间戳格式)

仅限输出。更新时间戳。

RetailThirdPartyId JSON 表示法

{
  "id": string,
  "owner": string
}

字段

id 字符串 零售商或制造商使用的第三方 ID(例如 SKU 或 MPN)。
所有者 string “拥有”第三方标识符的实体,例如销售此商品的制造商或零售商。

方法:projects.locations.retailCatalogs.retailProducts.create

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*}/retailProducts

路径参数

父级 字符串 必需。父级标识符。

请求正文

请求正文包含一个 RetailProduct 实例。

响应正文

如果成功,响应正文将包含一个新创建的 RetailProduct 实例。

方法:projects.locations.retailCatalogs.retailProducts.get

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProducts/*

路径参数

name 字符串 必需。RetailProduct 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 RetailProduct 实例。

方法:projects.locations.retailCatalogs.retailProducts.list

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*}/retailProducts

路径参数

父级 字符串 必需。父级标识符。

查询参数

filter 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize integer 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
orderBy string 可选。以逗号分隔列表形式表示的排序依据字段,按升序排列。在字段名称后添加“desc”表示降序。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含采用以下结构的数据: JSON 表示法

{
  "retailProducts": [
    {
      object (RetailProducts)
    }
  ],
  "nextPageToken": string
}

方法:projects.locations.retailCatalogs.retailProducts.delete

HTTP 请求

DELETE https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProducts/*

路径参数

name 字符串 必需。RetailProduct 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文为空。

资源:projects.locations.retailProductImages

JSON 表示法

{
  "name": string,
  "displayName": string,
  "sourceType": enum(SourceType),
  "gcsUri": string,
  "resourceState": enum(RetailResourceState),
   "labels": {
    string: string,
    ...
    }
   "createTime": string,
   "updateTime": string
}

字段


名称

字符串

仅限输出。RetailProductImage 的资源名称

displayName

字符串

可选。RetailProductImage 的显示名称。

sourceType

枚举

可选。来源类型

gcsUri

字符串

可选。RetailProductImage 的 Cloud Storage 位置。除非图片由 Google 提供(例如,当来源类型为 SOURCE_TYPE_GOOGLE 时),否则应设置此字段。

resourceState

枚举

仅限输出。RetailProductImage 的状态。

个标签

映射(键:字符串,值:字符串)

带有用户定义元数据的标签,用于整理 RetailProductImage。

标签键和值不得超过 64 个字符(Unicode 代码点),并且只能包含小写字母、数字字符、下划线和短划线。允许使用国际字符。

如需了解详情和标签示例,请访问 https://goo.gl/xmQnxf。

包含 "key": value 对列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字符串(时间戳格式)

仅限输出。创建时间戳。

updateTime

字符串(时间戳格式)

仅限输出。更新时间戳。

SourceType 枚举值

SOURCE_TYPE_UNSPECIFIED 未知数据源。不应使用。
SOURCE_TYPE_FIXED_CAMERA 图片由固定摄像头拍摄。
SOURCE_TYPE_HAND_HELD_CAMERA 图片是使用手持相机拍摄的。
SOURCE_TYPE_CRAWLED 系统会从网络上抓取图片。
SOURCE_TYPE_SYSTEM_GENERATED 图片是从带有真人标签的原始图片中剪裁出来的。

方法:projects.locations.retailCatalogs.retailProducts.retailProductImages.create

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*/retailProducts/*}/retailProductImages

路径参数

父级 字符串 必需。父级标识符。

请求正文

请求正文包含一个 RetailProductImage 实例。

响应正文

如果成功,响应正文将包含一个新创建的 RetailProductImage 实例。

方法:projects.locations.retailCatalogs.retailProducts.retailProductImages.get

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProducts/*/retailProductImages/*

路径参数

name 字符串 必需。RetailProductImage 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 RetailProductImage 实例。

方法:projects.locations.retailCatalogs.retailProducts.retailProductImages.list

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*/retailProducts/*}/retailProductImages

路径参数

父级 字符串 必需。父级标识符。

查询参数

filter 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize integer 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
orderBy string 可选。以逗号分隔列表形式表示的排序依据字段,按升序排列。在字段名称后添加“desc”表示降序。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含结构如下的数据:

JSON 表示法

{
  "retailProductImages": [
    {
      object (RetailProductImages)
    }
  ],
  "nextPageToken": string
}

方法:projects.locations.retailCatalogs.retailProducts.retailProductImages.delete

HTTP 请求

DELETE https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProducts/*/retailProductImages/*

路径参数

name 字符串 必需。RetailProductImage 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文为空。

资源:projects.locations.retailCatalogs.retailProductSets

JSON 表示法

{
  "name": string,
  "displayName": string,
  "retailProductIds": [string],
  "resourceState": enum(RetailResourceState),
   "labels": {
    string: string,
    ...
    }
   "createTime": string,
   "updateTime": string
}

字段


名称

字符串

仅限输出。RetailProductSet 的资源名称

displayName

字符串

可选。RetailProductSet 的显示名称。

retailProductIds []

字符串

仅限输出。属于此 RetailProductSet 的商品的资源 ID。RetailProductSet 中的商品应位于同一目录中。

resourceState

枚举

仅限输出。RetailProductSet 的状态。

个标签

映射(键:字符串,值:字符串)

带有用户定义的元数据的标签,用于整理 RetailProductSet。

标签键和值不得超过 64 个字符(Unicode 代码点),并且只能包含小写字母、数字字符、下划线和短划线。允许使用国际字符。

如需了解详情和标签示例,请访问 https://goo.gl/xmQnxf。

包含 "key": value 对列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字符串(时间戳格式)

仅限输出。创建时间戳。

updateTime

字符串(时间戳格式)

仅限输出。更新时间戳。

方法:projects.locations.retailCatalogs.retailProductSets.create

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*}/retailProductSets

路径参数

父级 字符串 必需。父级标识符。

请求正文

请求正文包含 RetailProductSet 的实例。

响应正文

如果成功,响应正文将包含一个新创建的 RetailProductSet 实例。

方法:projects.locations.retailCatalogs.retailProductSets.get

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProductSets/*

路径参数

name 字符串 必需。RetailProductSet 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文会包含一个 RetailProductSet 实例。

方法:projects.locations.retailCatalogs.retailProductSets.list

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*}/retailProductSets

路径参数

父级 字符串 必需。父级标识符。

查询参数

filter 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize integer 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
orderBy string 可选。以逗号分隔列表形式表示的排序依据字段,按升序排列。在字段名称后添加“desc”表示降序。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含结构如下的数据:

JSON 表示法

{
  "retailProductSets": [
    {
      object (RetailProductSets)
    }
  ],
  "nextPageToken": string
}

方法:projects.locations.retailCatalogs.retailProductSets.delete

HTTP 请求

DELETE https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProductSets/*

路径参数

name 字符串 必需。RetailProductSet 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文为空。

方法:projects.locations.retailCatalogs.retailProductSets.add

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProductSets/*}:remove

路径参数

name 字符串 必需。RetailProductSet 资源名称。

请求正文

JSON 表示法

{
  "productIds": [string],
  "productFilter": string
}

字段


productIds[ ]

字符串

要添加的 RetailProducts 的资源 ID。它们必须全部属于与指定目标 RetailProductSet 相同的 RetailCatalog。一个请求中最多可以指定 200 个 RetailProducts ID。不能与 productFilter 一起使用。

productFilter

字符串

将应用于父级 RetailCatalog 中所有 RetailProduct 的标准过滤条件,用于选择满足过滤条件的商品并将其添加到 RetailProductSet 中。不能与 product_ids 一起使用。支持的过滤条件:https://google.aip.dev/160

响应正文

如果成功,则响应正文包含一个 Operation 实例。

方法:projects.locations.retailCatalogs.retailProductSets.remove

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProductSets/*}:add

路径参数

name 字符串 必需。RetailProductSet 资源名称。

请求正文

JSON 表示法

{
  "productIds": [string],
  "productFilter": string
}

字段


productIds[ ]

字符串

要移除的 RetailProducts 的资源 ID。如果指定的 RetailProducts 不属于此 RetailProductSet,则会被忽略。一个请求中最多可以指定 200 个 RetailProducts ID。不能与 products_filter 一起使用。

productFilter

字符串

将应用于指定 RetailProductSet 中所有 RetailProduct 的标准过滤条件,用于选择满足过滤条件的商品并将其从 RetailProductSet 中移除。不能与 product_ids 一起使用。支持的过滤条件:https://google.aip.dev/160

响应正文

如果成功,则响应正文包含一个 Operation 实例。

资源:projects.locations.retailCatalogs.retailProductRecognitionIndexes

JSON 表示法

{
  "name": string,
  "displayName": string,
  "description": string,
  "retailProductSet": [string],
   "resourceState": enum(RetailResourceState),
   "labels": {
    string: string,
    ...
    }
   "createTime": string,
   "updateTime": string
}

字段


名称

字符串

仅限输出。RetailProductRecognitionIndex 资源的资源名称。

displayName

字符串

可选。RetailProductRecognitionIndex 的显示名称。

说明

字符串

可选。RetailProductRecognitionIndex 的说明。

retailProductSet[]

字符串

可选。用于创建此资源的 RetailProductSet 的资源名称。如果设置,RetailProductRecognitionIndex 将仅包含给定 RetailProductSet 中的商品。如果未设置,系统将使用父级目录中的所有商品。

resourceState

枚举

仅限输出。RetailProductRecognitionIndex 的状态。

个标签

映射(键:字符串,值:字符串)

带有用户定义的元数据的标签,用于整理 RetailProductRecognitionIndex。

标签键和值不得超过 64 个字符(Unicode 代码点),并且只能包含小写字母、数字字符、下划线和短划线。允许使用国际字符。

如需了解详情和标签示例,请访问 https://goo.gl/xmQnxf。

包含 "key": value 对列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字符串(时间戳格式)

仅限输出。创建时间戳。

updateTime

字符串(时间戳格式)

仅限输出。更新时间戳。

方法:projects.locations.retailCatalogs.retailProductRecognitionIndexes.create

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*}/retailProductRecognitionIndexes

路径参数

父级 字符串 必需。父级标识符。

请求正文

请求正文包含一个 RetailProductRecognitionIndex 实例。

响应正文

如果成功,响应正文将包含一个新创建的 RetailProductRecognitionIndex 实例。

方法:projects.locations.retailCatalogs.retailProductRecognitionIndexes.get

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProductRecognitionIndexes/*

路径参数

name 字符串 必需。RetailProductRecognitionIndex 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含一个 RetailProductRecognitionIndex 实例。

方法:projects.locations.retailCatalogs.retailProductRecognitionIndexes.list

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*/retailCatalogs/*}/retailProductRecognitionIndexes

路径参数

父级 字符串 必需。父级标识符。

查询参数

filter 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize integer 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
orderBy string 可选。以逗号分隔列表形式表示的排序依据字段,按升序排列。在字段名称后添加“desc”表示降序。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含结构如下的数据:

JSON 表示法

{
  "retailProductRecognitionIndexes": [
    {
      object (RetailProductRecognitionIndex)
    }
  ],
  "nextPageToken": string
}

方法:projects.locations.retailCatalogs.retailProductRecognitionIndexes.delete

HTTP 请求

DELETE https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailCatalogs/*/retailProductRecognitionIndexes/*

路径参数

name 字符串 必需。ProductRecognitionIndex 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

资源:projects.locations.retailEndpoints

JSON 表示法

{
  "name": string,
  "displayName": string,
  "description": string,
  "deployedProductRecognitionIndex": string,
  "resourceState": enum(RetailResourceState),
  "productRecognitionConfig": { object(RetailProductRecognitionConfig) },
  "tagRecognitionConfig": { object(RetailTagRecognitionConfig) },
  "labels": {
    string: string,
    ...
   }
  "createTime": string,
  "updateTime": string
}

字段


名称

字符串

仅限输出。RetailEndpoint 资源的资源名称。

displayName

字符串

可选。RetailEndpoint 的显示名称。

说明

字符串

可选。RetailEndpoint 的说明。

deployedProductRecognitionIndex

字符串

仅限输出。部署到此 RetailEndpoint 的 ProductRecognitionIndex 的资源名称。

productRecognitionConfig

对象

可选。产品识别配置。

tagRecognitionConfig

对象

可选。标签识别配置。

resourceState

枚举

仅限输出。RetailProductRecognitionIndex 的状态。

个标签

映射(键:字符串,值:字符串)

带有用户定义的元数据的标签,用于整理 RetailProductRecognitionIndex。

标签键和值不得超过 64 个字符(Unicode 代码点),并且只能包含小写字母、数字字符、下划线和短划线。允许使用国际字符。

如需了解详情和标签示例,请访问 https://goo.gl/xmQnxf。

包含 "key": value 对列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字符串(时间戳格式)

仅限输出。创建时间戳。

updateTime

字符串(时间戳格式)

仅限输出。更新时间戳。

RetailProductRecognitionConfig

JSON 表示法

{
  "productDetectionModel": string,
  "detectionConfidenceThreshold": float,
  "recognitionConfidenceThreshold": float,
  "additionalConfig": { object }
}

字段

|

productDetectionModel 字符串 必需。用于检测输入图片中商品的模型。支持的值:“builtin/stable”(默认)或 Vertex AI 模型资源名称。
detectionConfidenceThreshold 浮点数 可选。用于过滤检测结果的置信度阈值。如果未设置,系统将使用默认值。
recognitionConfidenceThreshold 浮点数 可选。用于过滤识别结果的置信度阈值。如果未设置,系统将使用默认值。
additionalConfig object (Struct format) 可选。商品识别的其他配置。

RetailTagRecognitionConfig

JSON 表示法

{
  "tagDetectionModel": string,
  "tagParsingModel": string,
  "detectionConfidenceThreshold": float,
  "parsingConfidenceThreshold": float,
  "additionalConfig": { object }
}

字段

tagDetectionModel 字符串 必需。用于检测输入图片中标签的模型。支持的值:Vertex AI 模型资源。
tagParsingModel 字符串 必需。用于解析检测到的标签上的文本的模型。支持的值:Vertex AI 模型资源。
detectionConfidenceThreshold 浮点数 可选。用于过滤检测结果的置信度阈值。如果未设置,系统将使用默认值。
parsingConfidenceThreshold 浮点数 可选。用于过滤文本解析结果的置信度阈值。如果未设置,系统将使用默认值。
additionalConfig object (Struct format) 可选。用于标签识别的其他配置。

方法:projects.locations.retailEndpoints.create

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*}/retailEndpoints

路径参数

父级 字符串 必需。父级标识符。

请求正文

请求正文包含一个 RetailEndpoint 实例。

响应正文

如果成功,响应正文将包含一个新创建的 RetailEndpoint 实例。

方法:projects.locations.retailEndpoints.get

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailEndpoints/*}

路径参数

name 字符串 必需。RetailEndpoint 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 RetailEndpoint 实例。

方法:projects.locations.retailEndpoints.list

HTTP 请求

GET https://visionai.googleapis.com/v1alpha1/{parent=projects/*/locations/*}/retailEndpoints

路径参数

父级 字符串 必需。父级标识符。

查询参数

filter 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize integer 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
orderBy string 可选。以逗号分隔列表形式表示的排序依据字段,按升序排列。在字段名称后添加“desc”表示降序。

请求正文

请求正文必须为空。

响应正文

如果成功,响应正文将包含结构如下的数据:

JSON 表示法

{
  "retailEndpoints": [
    {
      object (RetailEndpoint)
    }
  ],
  "nextPageToken": string
}

方法:projects.locations.retailEndpoints.delete

HTTP 请求

DELETE https://visionai.googleapis.com/v1alpha1/{name=projects/*/locations/*/retailEndpoints/*

路径参数

name 字符串 必需。RetailEndpoint 标识符。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文为空。

方法:projects.locations.retailEndpoints.deployRetailProductRecognitionIndex

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{retailEndpoint=projects/*/locations/*/retailEndpoints/*}:deployRetailProductRecognitionIndex

路径参数

retailEndpoint string 必需。RetailProductRecognitionIndex 部署到的 RetailEndpoint 资源的资源名称。

请求正文

JSON 表示法

{
  "retailProductRecognitionIndex": string,
}

字段

retailProductRecognitionIndex string 必需。要部署的 RetailProductRecognitionIndex 的资源名称。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

方法:projects.locations.retailEndpoints.undeployRetailProductRecognitionIndex

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{retailEndpoint=projects/*/locations/*/retailEndpoints/*}:undeployRetailProductRecognitionIndex

路径参数

retailEndpoint 字符串 必需。取消部署操作将作用于的 RetailEndpoint 资源的资源名称。

请求正文

请求正文必须为空。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

方法:projects.locations.retailEndpoints.batchAnalyze

HTTP 请求

POST https://visionai.googleapis.com/v1alpha1/{retailEndpoint=projects/*/locations/*/retailEndpoints/*}:batchAnalyze

路径参数

retailEndpoint 字符串 必需。用于处理推理请求的 RetailEndpoint 的资源名称。

请求正文

JSON 表示法

{
  "gcsSource": string,
  "features": { object(Feature) },
  // Union field output can be only one of the following:
  "outputGcsDestination": string,
  "corpus": string,
  // End of list of possible types for union field output.
  "bigqueryTable": string
}

字段

gcsSource 字符串 必需。输入内容所在的 Cloud Storage 位置。您可以提供多个输入位置。所有输入位置的内容都将批量处理。支持的内容:TXT 文件,每行都是图片的完整路径。一个请求最多可支持 5 万张图片。
outputGcsDestination 字符串 可选。要向其写入输出的目录的 Cloud Storage 位置。
corpus 字符串 可选。图片仓库语料库的资源名称。暂不支持。
bigqueryTable 字符串 可选。用于导出注解的 BigQuery 表的资源名称。格式为“projects/*/datasets/*/tables/*”。如果设置此参数,则通过机器学习推理生成的注释也会导出到给定的 BigQuery 表。暂不支持。
features[] 对象 必需。要执行的机器学习推理类型。

功能

JSON 表示法

{
  "type": enum(Type),
  "productRecognitionConfig": object(RetailProductRecognitionConfig),
  "tagRecognitionConfig": object(RetailTagRecognitionConfig)
}

字段

类型 枚举 必需。特征类型。
productRecognitionConfig object 可选。针对商品识别功能的每个请求替换。仅当 type 设置为 TYPE_PRODUCT_RECOGNITION 时,此字段才有效。
tagRecognitionConfig object 可选。针对标签识别功能的每个请求替换。仅当类型设置为 TYPE_TAG_RECOGNITION 时,此字段才有效。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

类型

GcsSource

JSON 表示法

{
  "uris": [string]
}

字段

uris[] 字符串 必需。对 Cloud Storage 路径的引用。

类型

ENUM 值

TYPE_UNSPECIFIED 默认值。不应使用。
TYPE_PRODUCT_RECOGNITION 产品识别。必须在部署了 RetailProductRecognitionIndex 的 RetailEndpoint 上使用。
TYPE_TAG_RECOGNITION 标签检测和解析。必须在具有 RetailTagRecognitionConfig 的 RetailEndpoint 上使用。

RetailProductIoFormat

JSON 表示法

{
  "retailProduct": { object(RetailProduct) },
  "retailProductImages": [ { object(RetailProductImage) }]
}

字段

retailProduct 对象 必需。待导入 RetailProduct
retailProductImages[ ] object 可选。要导入的给定 RetailProduct 的 RetailProductImage。

RetailResourceState

ENUM 值

RETAIL_RESOURCE_STATE_UNSPECIFIED 默认值。不应使用。
RETAIL_RESOURCE_STATE_CREATING 正在创建状态。
RETAIL_RESOURCE_STATE_CREATED 已创建状态。
RETAIL_RESOURCE_STATE_UPDATING 正在更新状态。
RETAIL_RESOURCE_STATE_DELETED 状态已删除。
RETAIL_RESOURCE_STATE_ERROR 状态错误。