標記辨識器指南

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

這個模型可做為主要 AI 構件,用於分析及解讀零售商店中的產品圖像資料。舉例來說,您可以將這個模型套用至由本機攝影機或行動裝置拍攝的貨架相片。

標記辨識器和產品辨識器的用途

產品辨識器模型標籤辨識器模型可做為主要 AI 構件,用於分析及解讀零售商店中產品和標籤的圖像資料,例如透過安裝的攝影機或行動裝置 / 平台擷取的貨架掃描圖像。

產品辨識器和標籤辨識器模型整合了多項 Google AI 模型和資料核心功能,可協助零售商和/或技術合作夥伴解決零售貨架的關鍵問題,包括:

  • 偵測、辨識並瞭解圖片或貨架上的產品。
  • 根據使用者定義的鍵/值組合實體擷取架構,偵測、辨識及剖析標記 (例如價格標記或任何其他文字標記標記)。

具體來說,貨架檢查解決方案內含多個 Google AI 模型,可支援解決這些用途問題,例如:

  • 產品偵測模型 (由 Google 預先訓練,但您仍可自訂)。
  • 產品縮圖視覺嵌入模型,可將產品縮圖圖片轉換為數值特徵空間表示法。
  • Google OCR 模型,可擷取圖片中顯示的所有文字。
  • Google 實體擷取模型 (可自訂),可將原始文字轉換為使用者定義的鍵/值組合命名實體。

除了這些 Google AI 模型之外,貨架檢查解決方案還會運用 Google 龐大的產品資訊資料庫。這個產品資料庫中的產品資料包括產品的全球交易品項識別碼 / 通用產品代碼、產品品牌、名稱、多國語言說明、產品標誌,以及各種包裝變化的圖片。產品資料庫包含先前提到的產品縮圖視覺嵌入模型,可讓產品辨識工具模型立即辨識許多產品。

舉例來說,假設有下列擷取的貨架圖片,貨架檢查解決方案的目標是:

  1. 偵測並定位圖片中的所有產品商品盒 (可見,且未嚴重遮蔽),並在全球交易品項識別碼 / 通用產品代碼層級辨識個別產品商品盒的產品身分。
  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。您可以使用有意義的字串 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 Object Detection 模型訓練功能提供全代管的模型訓練體驗,但您仍需負責準備樣本圖片資料集,並在其中標註物件邊界框架,以便做為訓練資料集,並將其提供給模型訓練主控台。 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 尚未完全支援整合式控制台體驗,但您仍可利用這項自訂的標記偵測和標記實體剖析模型訓練 (使用 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,
    ...
  }
}

欄位


name

字串

僅供輸出。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

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

查詢參數

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/*}

路徑參數

名稱 字串 這是必要旗標,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 這是必要旗標,匯入檔案格式。

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

欄位


name

字串

僅供輸出。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

string (Timestamp 格式)

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

updateTime

string (Timestamp 格式)

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

RetailThirdPartyId JSON 呈現方式

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

欄位

id 字串 零售商或製造商使用的第三方 ID (例如 SKU 或製造商零件編號)。
擁有者 字串 擁有第三方 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。

查詢參數

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/*

路徑參數

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

欄位


name

字串

僅供輸出。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

string (Timestamp format)

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

updateTime

string (Timestamp format)

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

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。

查詢參數

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/*

路徑參數

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

要求主體

要求主體必須為空白。

回應主體

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

資源:projects.locations.retailCatalogs.retailProductSets

JSON 表示法

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

欄位


name

字串

僅供輸出。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

string (Timestamp 格式)

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

updateTime

string (Timestamp 格式)

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

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

查詢參數

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/*

路徑參數

名稱 字串 這是必要旗標,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。這些資源都必須屬於與指定目的地 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[ ]

字串

要移除的 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
}

欄位


name

字串

僅供輸出。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

string (Timestamp format)

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

updateTime

string (Timestamp format)

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

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

查詢參數

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/*

路徑參數

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

欄位


name

字串

僅供輸出。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

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

路徑參數

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。

查詢參數

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/*

路徑參數

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

欄位

類型 enum 這是必要旗標,地圖項目類型。
productRecognitionConfig 物件 (非必要) 產品辨識功能的個別要求覆寫值。只有在 type 設為 TYPE_PRODUCT_RECOGNITION 時才有效。
tagRecognitionConfig 物件 (非必要) 針對標記辨識功能的個別要求覆寫值。只有在 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[ ] 物件 選用。要匯入的指定 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 狀態錯誤。