標記辨識器指南

標記辨識器模型可協助您解決瞭解零售貨架時遇到的主要問題,也就是根據使用者定義的鍵/值組合實體擷取結構定義,辨識及剖析標記 (例如價格標籤或其他標籤)。

這個模型可做為主要 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。您可以使用有意義的字串 ID,例如「product-ABC」,也可以使用隨機產生的 ID,例如 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)」,且這個欄位的規則運算式限制為「」空白。
  • 「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=Your tag parsing model name
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

enum

僅供輸出。RetailCatalog 的狀態。

標籤

map (key: string, value: string)

含有使用者定義中繼資料的標籤,可整理 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

路徑參數

parent 字串 這是必要旗標,父項 ID。

要求主體

要求主體包含 RetailCatalog 的執行個體。

回應主體

如果成功,回應主體會包含新建立的 RetailCatalog 例項。

方法:projects.locations.retailCatalogs.get

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailCatalog ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 RetailCatalog 的執行個體。

方法:projects.locations.retailCatalogs.list

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

查詢參數

篩選器 字串 選用。用於篩選要求結果的運算式。
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/*}

路徑參數

名稱 字串 這是必要旗標,RetailCatalog ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 Operation 的執行個體。

方法:projects.locations.retailCatalogs.importRetailProducts

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailCatalog 資源名稱。

要求主體

JSON 表示法

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

欄位

gcsSource 物件 這是必要旗標,輸入內容的 Cloud Storage 位置。 您可以提供多個輸入位置。系統會一次匯入所有輸入位置的內容。支援的副檔名:1. JSONL 檔案。每行都是 RetailProductIoFormat 的 JSON 格式。
2. TXT 檔案。每行都是要匯入的產品全球交易品項識別碼。
格式 列舉 這是必要旗標,匯入檔案格式。

格式化 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

含有「鍵」:值組合清單的物件。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字串 (時間戳記格式)

僅供輸出。建立時間戳記。

updateTime

字串 (時間戳記格式)

僅供輸出。更新時間戳記。

RetailThirdPartyId JSON 呈現方式

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

欄位

id 字串 零售商或製造商使用的第三方 ID (例如 SKU 或 MPN)。
擁有者 字串 「擁有」第三方 ID 的實體,例如製造商或銷售這項產品的零售商。

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

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

要求主體

要求主體包含 RetailProduct 的執行個體。

回應主體

如果成功,回應主體會包含新建立的 RetailProduct 例項。

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

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailProduct ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 RetailProduct 的執行個體。

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

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

查詢參數

篩選器 字串 選用。用於篩選要求結果的運算式。
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/*

路徑參數

名稱 字串 這是必要旗標,RetailProduct ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會留白。

資源: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

含有「鍵」:值組合清單的物件。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字串 (時間戳記格式)

僅供輸出。建立時間戳記。

updateTime

字串 (時間戳記格式)

僅供輸出。更新時間戳記。

SourceType ENUM 值

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

要求主體

要求主體包含 RetailProductImage 的執行個體。

回應主體

如果成功,回應主體會包含新建立的 RetailProductImage 例項。

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

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailProductImage ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 RetailProductImage 的執行個體。

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

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

查詢參數

篩選器 字串 選用。用於篩選要求結果的運算式。
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/*

路徑參數

名稱 字串 這是必要旗標,RetailProductImage ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會留白。

資源: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

含有「鍵」:值組合清單的物件。例如:{ "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

路徑參數

parent 字串 這是必要旗標,父項 ID。

要求主體

要求主體包含 RetailProductSet 的例項。

回應主體

如果成功,回應內容會含有新建立的 RetailProductSet 例項。

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

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailProductSet ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 RetailProductSet 的例項。

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

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

查詢參數

篩選器 字串 選用。用於篩選要求結果的運算式。
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/*

路徑參數

名稱 字串 這是必要旗標,RetailProductSet ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會留白。

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

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailProductSet 資源名稱。

要求主體

JSON 表示法

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

欄位


productIds[ ]

字串

要新增的 RetailProducts 資源 ID。所有 RetailProduct 都必須與指定的目的地 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

路徑參數

名稱 字串 這是必要旗標,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

enum

僅供輸出。RetailProductRecognitionIndex 的狀態。

標籤

map (key: string, value: string)

含有使用者定義中繼資料的標籤,用於整理 RetailProductRecognitionIndex。

標籤鍵與值的長度不得超過 64 個字元 (Unicode 碼位),只能使用小寫英文字母、數字、底線和破折號。可使用國際字元。

如要進一步瞭解標籤和查看範例,請參閱 https://goo.gl/xmQnxf

含有「鍵」:值組合清單的物件。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字串 (Timestamp 格式)

僅供輸出。建立時間戳記。

updateTime

字串 (Timestamp 格式)

僅供輸出。更新時間戳記。

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

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

要求主體

要求主體包含 RetailProductRecognitionIndex 的執行個體。

回應主體

如果成功,回應主體會包含新建立的 RetailProductRecognitionIndex 例項。

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

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailProductRecognitionIndex ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 RetailProductRecognitionIndex 的執行個體。

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

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

查詢參數

篩選器 字串 選用。用於篩選要求結果的運算式。
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/*

路徑參數

名稱 字串 這是必要旗標,ProductRecognitionIndex ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 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

含有「鍵」:值組合清單的物件。例如:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

createTime

字串 (Timestamp 格式)

僅供輸出。建立時間戳記。

updateTime

字串 (Timestamp 格式)

僅供輸出。更新時間戳記。

RetailProductRecognitionConfig

JSON 表示法

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

欄位

|

productDetectionModel 字串 這是必要旗標,用來偵測輸入圖片中產品的模型。支援的值:「builtin/stable」(預設值) 或 Vertex AI 模型資源名稱。
detectionConfidenceThreshold 浮點數 選用。用於篩選偵測結果的信賴度門檻。如未設定,系統會使用預設值。
recognitionConfidenceThreshold 浮點數 選用。用於篩選辨識結果的信賴度門檻。如未設定,系統會使用預設值。
additionalConfig 物件 (struct 格式) 選用。產品辨識的其他設定。

RetailTagRecognitionConfig

JSON 表示法

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

欄位

tagDetectionModel 字串 這是必要旗標,用於偵測輸入圖片中標記的模型。支援的值:Vertex AI 模型資源。
tagParsingModel 字串 這是必要旗標,模型會剖析偵測到的代碼中的文字。支援的值:Vertex AI 模型資源。
detectionConfidenceThreshold 浮點數 選用。用於篩選偵測結果的信賴度門檻。如未設定,系統會使用預設值。
parsingConfidenceThreshold 浮點數 選用。用於篩選文字剖析結果的信賴度門檻。如未設定,系統會使用預設值。
additionalConfig 物件 (struct 格式) 選用。代碼辨識的其他設定。

方法:projects.locations.retailEndpoints.create

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

要求主體

要求主體包含 RetailEndpoint 的執行個體。

回應主體

如果成功,回應主體會包含新建立的 RetailEndpoint 例項。

方法:projects.locations.retailEndpoints.get

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,RetailEndpoint ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含 RetailEndpoint 的執行個體。

方法:projects.locations.retailEndpoints.list

HTTP 要求

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

路徑參數

parent 字串 這是必要旗標,父項 ID。

查詢參數

篩選器 字串 選用。用於篩選要求結果的運算式。
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/*

路徑參數

名稱 字串 這是必要旗標,RetailEndpoint ID。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會留白。

方法: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 物件 <0x0 選用。針對產品辨識功能,在要求中覆寫設定。只有在類型設為 TYPE_PRODUCT_RECOGNITION 時,這項屬性才會生效。
tagRecognitionConfig 物件 <0x0 選用。每個要求都會覆寫標記辨識功能。只有在類型設為 TYPE_TAG_RECOGNITION 時,這項設定才會生效。

回應主體

如果成功,回應主體會包含 Operation 的執行個體。

類型

GcsSource

JSON 表示法

{
  "uris": [string]
}

欄位

uris[] 字串 這是必要旗標,Cloud Storage 路徑的參照。

類型

ENUM 值

TYPE_UNSPECIFIED 預設值。不應使用。
TYPE_PRODUCT_RECOGNITION 產品辨識。必須在已部署 RetailProductRecognitionIndexRetailEndpoint 上使用。
TYPE_TAG_RECOGNITION 標記偵測和剖析。必須在 RetailEndpoint 上搭配 RetailTagRecognitionConfig 使用。

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 狀態錯誤。