标记识别器指南

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

此模型可以用作分析和解读零售店内商品图片数据的主要 AI 构建块。例如,您可以将此模型用于本地摄像头或移动设备拍摄的货架图片。

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

商品识别器模型条形码识别器模型可用作主要 AI 构建块,用于分析和解读零售店中商品和条形码周围的图片数据,例如安装的摄像头或移动设备 / 平台拍摄的货架扫描图片。

商品识别器和条形码识别器模型采用了多项 Google AI 核心建模和数据功能,可帮助零售商和/或技术合作伙伴解决了解零售货架时遇到的关键问题,包括:

  • 检测、识别图片或货架上的产品,从而了解这些产品。
  • 根据用户定义的键值对实体提取架构,检测、识别和解析标签(例如价格标签或任何其他文本标签)。

值得注意的是,货架检查解决方案中包含多种具有差异性的 Google AI 模型,可支持解决这些应用场景问题,例如

  • 商品检测模型(由 Google 预训练,但您仍可以对其进行自定义)。
  • 商品缩略图视觉嵌入模型,用于将商品缩略图图片转换为数值特征空间表示法。
  • Google OCR 模型,用于提取图片中可见的所有文本。
  • Google 实体提取模型(可供您自定义),用于将原始文本转换为用户定义的键值对命名实体。

除了这些 Google AI 模型之外,货架检查解决方案还利用 Google 庞大的产品信息数据库。此商品数据库中的商品数据包括商品的 GTIN/UPC 标识、商品品牌、商品名、多语言说明、商品徽标以及各种包装款式/规格的图片。借助包含前面提到的商品缩略图视觉嵌入模型的商品数据库,商品识别器模型能够立即识别许多商品。

例如,假设拍摄到了如下搁架图片,搁架检查解决方案旨在:

  1. 检测和定位图片中的所有商品条状盒(可见,未严重遮挡),并在 GTIN / UPC 级别识别每个单独商品条状盒的商品身份。
  2. 检测并定位图片中的所有标签框(可见),识别标签中的所有文本字符串,然后尝试将文本解析为用户定义的键值对实体提取架构,例如商品项说明、价格值。

实现这些解决方案的两大 AI 功能是商品识别器模型和链接识别器模型,我们将在以下部分详细介绍这两种模型。这两个主要提供图片推理服务的 API 中,每个 API 都有一个或多个可供您自定义的组件。我们将首先介绍 API 使用情况的推理路径,然后简要介绍您可以如何通过某些用户配置或您进行的某些模型训练来自定义相关组件。

标记识别器功能

此模型会识别代码中的所有文本字符串,然后尝试将文本解析为用户定义的键值对实体提取架构,例如商品项说明或价格值。其中包括以下具有差异化的 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 数据标注服务,以便您创建数据标注任务。如需了解详情,请访问以下 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)”,并且此字段的正则表达式约束条件为“none”。
  • “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 作为集成的控制台体验,但您仍然可以通过执行一些手动自助步骤,利用此自定义代码检测和代码实体解析模型训练,并在 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

string(时间戳格式)

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

updateTime

string(时间戳格式)

仅供输出。更新时间戳。

resourceState

枚举

仅供输出。RetailCatalog 的状态。

标签

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

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

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

如需详细了解标签以及标签示例,请访问 https://goo.gl/xmQnxf

一个包含“键值对”列表的对象。例如:{ "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

路径参数

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

查询参数

过滤条件 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器会选择相应的默认值。
orderBy 字符串 可选。要按升序排序的字段的逗号分隔列表。在字段名称后面使用“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。
格式 枚举 必需。导入文件格式。

设置 ENUM 值的格式

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

一个对象,它包含“键”-“值”对的列表。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

string(时间戳格式)

仅供输出。创建时间戳。

updateTime

string(时间戳格式)

仅供输出。更新时间戳。

RetailThirdPartyId JSON 演示

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

字段

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

方法: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

路径参数

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

查询参数

过滤条件 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器会选择相应的默认值。
orderBy 字符串 可选。要按升序排序的字段的逗号分隔列表。在字段名称后面使用“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 的状态。

标签

map (key: string, value: string)

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

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

如需详细了解标签以及标签示例,请访问 https://goo.gl/xmQnxf

一个包含“键值对”列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

string(时间戳格式)

仅供输出。创建时间戳。

updateTime

string(时间戳格式)

仅供输出。更新时间戳。

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

路径参数

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

查询参数

过滤条件 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器会选择相应的默认值。
orderBy 字符串 可选。要按升序排序的字段的逗号分隔列表。在字段名称后面使用“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

一个对象,它包含“键”-“值”对的列表。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

string(时间戳格式)

仅供输出。创建时间戳。

updateTime

string(时间戳格式)

仅供输出。更新时间戳。

方法: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

路径参数

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

查询参数

过滤条件 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器会选择相应的默认值。
orderBy 字符串 可选。要按升序排序的字段的逗号分隔列表。在字段名称后面使用“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[ ]

字符串

要添加的 RetailProduct 的资源 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[ ]

字符串

要移除的 RetailProduct 的资源 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 的状态。

标签

map (key: string, value: string)

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

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

如需详细了解标签以及标签示例,请访问 https://goo.gl/xmQnxf

一个包含“键值对”列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

string(时间戳格式)

仅供输出。创建时间戳。

updateTime

string(时间戳格式)

仅供输出。更新时间戳。

方法: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

路径参数

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

查询参数

过滤条件 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器会选择相应的默认值。
orderBy 字符串 可选。要按升序排序的字段的逗号分隔列表。在字段名称后面使用“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 的状态。

标签

map (key: string, value: string)

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

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

如需详细了解标签以及标签示例,请访问 https://goo.gl/xmQnxf

一个包含“键值对”列表的对象。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

string(时间戳格式)

仅供输出。创建时间戳。

updateTime

string(时间戳格式)

仅供输出。更新时间戳。

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

路径参数

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

查询参数

过滤条件 字符串 可选。用于过滤请求结果的表达式。
pageToken 字符串 可选。标识服务器应返回的结果页面的令牌。
pageSize 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器会选择相应的默认值。
orderBy 字符串 可选。要按升序排序的字段的逗号分隔列表。在字段名称后面使用“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 字符串 必需。RetailProductRecognitionIndex 部署到的 RetailEndpoint 资源的资源名称。

请求正文

JSON 表示法

{
  "retailProductRecognitionIndex": string,
}

字段

retailProductRecognitionIndex 字符串 必需。要部署的 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 设置为 TYPE_TAG_RECOGNITION 时,此参数才有效。

响应正文

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

类型

GcsSource

JSON 表示法

{
  "uris": [string]
}

字段

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

类型

枚举值

TYPE_UNSPECIFIED 默认值。不应使用。
TYPE_PRODUCT_RECOGNITION 产品识别。必须在已部署 RetailProductRecognitionIndexRetailEndpoint 上使用。
TYPE_TAG_RECOGNITION 代码检测和解析。必须在包含 RetailTagRecognitionConfig 的 RetailEndpoint 上使用。

RetailProductIoFormat

JSON 表示法

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

字段

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

RetailResourceState

枚举值

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