标记识别器指南

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

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

标记识别器和商品识别器的应用场景

商品识别器标签识别器模型可作为主要的 AI 构建块,用于分析和解读您可能从零售店捕获的商品和标签图像数据。

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

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

具体而言,Gemini Pro 包含多项差异化的 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 Object Detection 功能执行自定义的标记检测模型训练。
  2. 使用自定义 OCR 引擎通过 Vertex AI/AutoML Vision Object Detection 功能执行标记实体解析模型训练。
  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)”,并且此字段的正则表达式约束为“”。
  • “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 部署尚未完全支持作为集成控制台体验,但您仍然可以利用此自定义的商品检测和商品实体解析模型训练(使用 Vertex AI 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

string (Timestamp format)

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

updateTime

string (Timestamp format)

仅限输出。更新时间戳。

resourceState

enum

仅限输出。RetailCatalog 的状态。

个标签

map (key: string, value: string)

带有用户定义的元数据的标签,用于整理您的 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 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
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

enum

可选。来源类型

gcsUri

字符串

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

resourceState

enum

仅限输出。RetailProductImage 的状态。

个标签

map (key: string, value: string)

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

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

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

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

createTime

string (Timestamp format)

仅限输出。创建时间戳。

updateTime

string (Timestamp format)

仅限输出。更新时间戳。

RetailThirdPartyId JSON 表示法

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

字段

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

方法: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 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
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

enum

可选。来源类型

gcsUri

字符串

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

resourceState

enum

仅限输出。RetailProductImage 的状态。

个标签

map (key: string, value: string)

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

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

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

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

createTime

string (Timestamp format)

仅限输出。创建时间戳。

updateTime

string (Timestamp format)

仅限输出。更新时间戳。

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 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
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

enum

仅限输出。RetailProductSet 的状态。

个标签

map (key: string, value: string)

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

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

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

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

createTime

string (Timestamp format)

仅限输出。创建时间戳。

updateTime

string (Timestamp format)

仅限输出。更新时间戳。

方法: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 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
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。如果指定的 RetailProduct 不属于此 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

enum

仅限输出。RetailProductRecognitionIndex 的状态。

个标签

map (key: string, value: string)

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

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

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

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

createTime

string (Timestamp format)

仅限输出。创建时间戳。

updateTime

string (Timestamp format)

仅限输出。更新时间戳。

方法: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 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
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

enum

仅限输出。RetailProductRecognitionIndex 的状态。

个标签

map (key: string, value: string)

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

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

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

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

createTime

string (Timestamp format)

仅限输出。创建时间戳。

updateTime

string (Timestamp format)

仅限输出。更新时间戳。

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 整数 可选。请求的页面大小。 服务器返回的项可能要比请求的少。如果未指定,服务器将选择合适的默认值。
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 字符串 必需。RetailEndpoint 资源(RetailProductRecognitionIndex 部署到的资源)的资源名称。

请求正文

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 <0x0 可选。针对商品识别功能的每个请求替换。仅当类型设置为 TYPE_PRODUCT_RECOGNITION 时,此字段才有效。
tagRecognitionConfig object <0x0 可选。针对标记识别功能的每个请求替换项。仅当类型设置为 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 状态错误。