標記辨識器指南

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

這個模型可做為主要的 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 尚未完全支援整合式控制台體驗,您仍可利用這項自訂標記偵測和標記實體剖析模型訓練 (使用 Agent Platform Vision 的物件偵測功能),並透過多個手動自助服務步驟,在 Store Vision AI 的 BatchAnalyze API 中提供這些模型。

API 用量 - 批次分析推論

建立端點
  • ENDPOINT_ID=您的端點 ID
  • TAG_DETECTOR=您的標記偵測模型名稱
  • TAG_PARSER=標記剖析模型名稱
curl -sS -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" https://visionai.googleapis.com/v1alpha1/projects/PROJECT_ID/locations/us-central1/retailEndpoints?retail_endpoint_id=ENDPOINT_ID \
-d '{
  "tagRecognitionConfig": {
    "tag_detection_model": "TAG_DETECTOR_NAME",
    "tag_parsing_model": "TAG_PARSER_NAME"
  }
}'
  • INPUT_FILE_URI=輸入檔案的 Cloud Storage URI,輸入檔案中的每一行都是要處理的圖片 Cloud Storage URI,例如 gs://my-bucket/my-image.jpg
  • OUTPUT_URI_PREFIX=輸出結果檔案的 Cloud Storage URI 前置字串,例如 gs://my-bucket/my-output-dir
curl -sS -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" https://visionai.googleapis.com/v1alpha1/projects/PROJECT_ID/locations/us-central1/retailEndpoints/ENDPOINT_ID:batchAnalyze 
-d '{
  "gcsSource": {
    "uris": ["INPUT_FILE_URI"]
  },
  "features": [
    {
      "type": "TYPE_TAG_RECOGNITION",
     }
  ],
  "outputGcsDestination": {
    "outputUriPrefix": "OUTPUT_URI_PREFIX"
  }
}'
"features": [
    {
      "type": "TYPE_TAG_RECOGNITION",
      "tagRecognitionConfig": {
        "tag_detection_model": "'TAG_DETECTOR_NAME'",
        "tag_parsing_model": "TAG_PARSER_NAME"
      }
    }
  ],

您也可以在 tagRecognitionConfig (RetailTagRecognitionConfig 物件) 中設定更多欄位。詳情請參閱 API 參考資料中的資源說明。

API 參考資料

資源:projects.locations.retailCatalogs

JSON 表示法

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

欄位


名稱

字串

僅供輸出。RetailCatalog 的資源名稱

displayName

字串

選用。RetailCatalog 的顯示名稱。

createTime

字串 (時間戳記格式)

僅供輸出。這個 RetailCatalog 的建立時間戳記。

updateTime

字串 (時間戳記格式)

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

resourceState

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 執行個體。

Method: projects.locations.retailCatalogs.get

HTTP 要求

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

路徑參數

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

要求主體

要求主體必須為空白。

回應主體

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

Method: projects.locations.retailCatalogs.list

HTTP 要求

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

路徑參數

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

查詢參數

filter 字串 選用。用於篩選要求結果的運算式。
pageToken 字串 選用。用於識別伺服器應傳回結果頁面的權杖。
pageSize integer 選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。
orderBy string 選用。以半形逗號分隔的欄位清單,用於指定遞增排序。在欄位名稱後方加上「desc」則可遞減排序。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含結構如下的資料: JSON 表示法

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

Method: 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 或製造商零件編號)。
owner string 「擁有」第三方 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 integer 選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。
orderBy string 選用。以半形逗號分隔的欄位清單,用於指定遞增排序。在欄位名稱後方加上「desc」則可遞減排序。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體會包含結構如下的資料: JSON 表示法

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

Method: 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 執行個體。

Method: 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 integer 選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。
orderBy string 選用。以半形逗號分隔的欄位清單,用於指定遞增排序。在欄位名稱後方加上「desc」則可遞減排序。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體即會包含具有以下結構的資料:

JSON 表示法

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

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

HTTP 要求

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

路徑參數

名稱 字串 這是必要旗標,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 執行個體。

Method: projects.locations.retailCatalogs.retailProductSets.get

HTTP 要求

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

路徑參數

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

要求主體

要求主體必須為空白。

回應主體

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

Method: projects.locations.retailCatalogs.retailProductSets.list

HTTP 要求

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

路徑參數

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

查詢參數

filter 字串 選用。用於篩選要求結果的運算式。
pageToken 字串 選用。用於識別伺服器應傳回結果頁面的權杖。
pageSize integer 選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。
orderBy string 選用。以半形逗號分隔的欄位清單,用於指定遞增排序。在欄位名稱後方加上「desc」則可遞減排序。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體即會包含具有以下結構的資料:

JSON 表示法

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

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

HTTP 要求

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

路徑參數

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

欄位


名稱

字串

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

字串 (時間戳記格式)

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

updateTime

字串 (時間戳記格式)

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

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

HTTP 要求

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

路徑參數

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

要求主體

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

回應主體

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

Method: 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 integer 選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。
orderBy string 選用。以半形逗號分隔的欄位清單,用於指定遞增排序。在欄位名稱後方加上「desc」則可遞減排序。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體即會包含具有以下結構的資料:

JSON 表示法

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

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

HTTP 要求

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

路徑參數

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

字串 (時間戳記格式)

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

updateTime

字串 (時間戳記格式)

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

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。

查詢參數

filter 字串 選用。用於篩選要求結果的運算式。
pageToken 字串 選用。用於識別伺服器應傳回結果頁面的權杖。
pageSize integer 選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。
orderBy string 選用。以半形逗號分隔的欄位清單,用於指定遞增排序。在欄位名稱後方加上「desc」則可遞減排序。

要求主體

要求主體必須為空白。

回應主體

如果成功,回應主體即會包含具有以下結構的資料:

JSON 表示法

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

方法:projects.locations.retailEndpoints.delete

HTTP 要求

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

路徑參數

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

要求主體

要求主體必須為空白。

回應主體

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

方法:projects.locations.retailEndpoints.deployRetailProductRecognitionIndex

HTTP 要求

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

路徑參數

retailEndpoint string 這是必要旗標,部署 RetailProductRecognitionIndex 的 RetailEndpoint 資源名稱。

要求主體

JSON 表示法

{
  "retailProductRecognitionIndex": string,
}

欄位

retailProductRecognitionIndex string 這是必要旗標,要部署的 RetailProductRecognitionIndex 資源名稱。

回應主體

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

方法:projects.locations.retailEndpoints.undeployRetailProductRecognitionIndex

HTTP 要求

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

路徑參數

retailEndpoint 字串 這是必要旗標,要取消部署的 RetailEndpoint 資源名稱。

要求主體

要求主體必須為空白。

回應主體

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

方法:projects.locations.retailEndpoints.batchAnalyze

HTTP 要求

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

路徑參數

retailEndpoint 字串 這是必要旗標,用於提供推論要求的 RetailEndpoint 資源名稱。

要求主體

JSON 表示法

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

欄位

gcsSource 字串 這是必要旗標,輸入內容的 Cloud Storage 位置。您可以提供多個輸入位置。所有輸入位置的內容都會在一個批次中處理。支援的內容:TXT 檔案,每行都是圖片的完整路徑。一項要求最多可支援 5 萬張圖片。
outputGcsDestination 字串 選用。要寫入輸出的目錄 Cloud Storage 位置。
corpus 字串 選用。圖片倉庫語料庫的資源名稱。目前仍不支援。
bigqueryTable 字串 選用。用於匯出註解的 BigQuery 資料表資源名稱。格式為「projects/*/datasets/*/tables/*」。如果設定,系統也會將機器學習推論產生的註解,匯出至指定的 BigQuery 資料表。目前仍不支援。
features[] 物件 這是必要旗標,要執行的機器學習推論類型。

功能

JSON 表示法

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

欄位

類型 列舉 這是必要旗標,特徵類型。
productRecognitionConfig object 選用。產品辨識功能的個別要求覆寫。只有在類型設為 TYPE_PRODUCT_RECOGNITION 時,這項設定才會生效。
tagRecognitionConfig object 選用。標記辨識功能的個別要求覆寫。只有在類型設為 TYPE_TAG_RECOGNITION 時,這項設定才會生效。

回應主體

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

類型

GcsSource

JSON 表示法

{
  "uris": [string]
}

欄位

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

類型

ENUM 值

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

RetailProductIoFormat

JSON 表示法

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

欄位

retailProduct 物件 這是必要旗標,要匯入的 RetailProduct
retailProductImages[ ] object 選用。要匯入指定 RetailProduct 的 RetailProductImage。

RetailResourceState

ENUM 值

RETAIL_RESOURCE_STATE_UNSPECIFIED 預設值。不應使用。
RETAIL_RESOURCE_STATE_CREATING 正在建立狀態。
RETAIL_RESOURCE_STATE_CREATED 已建立狀態。
RETAIL_RESOURCE_STATE_UPDATING 正在更新狀態。
RETAIL_RESOURCE_STATE_DELETED 已刪除州。
RETAIL_RESOURCE_STATE_ERROR 狀態錯誤。