View a markdown version of this page

清單檔案格式 - Amazon Rekognition

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

清單檔案格式

以下各節顯示輸入、輸出和評估檔案的資訊清單檔案格式範例。

輸入資訊清單檔案

資訊清單檔案是以 JSON 線分隔的檔案,每一行都包含一個 JSON,其中包含單一映像的相關資訊。

輸入資訊清單檔案中的每個專案都必須包含具有 Amazon S3 儲存貯體中映像路徑的 source-ref 欄位,而對於自訂管制,則包含基本註釋的 content-moderation-groundtruth 欄位。一個資料集中的所有映像都預期位於同一個儲存貯體中。訓練和測試資訊清單檔案都是通用的結構。

自訂管制的 CreateProjectVersion 操作會使用「輸入資訊清單」中提供的資訊來訓練轉接器。

下列範例是包含不安全類別之單一映像的資訊清單檔案的一行:

{ "source-ref": "s3://foo/bar/1.jpg", "content-moderation-groundtruth": { "ModerationLabels": [ { "Name": "Rude Gesture" } ] } }

下列範例是單一不安全映像的資訊清單檔案,其中包含多個不安全類別,特別是裸露和粗魯手勢。

{ "source-ref": "s3://foo/bar/1.jpg", "content-moderation-groundtruth": { "ModerationLabels": [ { "Name": "Rude Gesture" }, { "Name": "Nudity" } ] } }

下列範例是不包含任何不安全類別的單一映像的資訊清單檔案的一行:

{ "source-ref": "s3://foo/bar/1.jpg", "content-moderation-groundtruth": { "ModerationLabels": [] } }

如需支援標籤的完整清單,請參閱內容管制

輸出資訊清單檔案

訓練工作完成後,會傳回輸出資訊清單檔案。輸出資訊清單檔案是 JSON 線上分隔的檔案,其中每一行都包含儲存單一映像資訊的 JSON。Amazon S3 OutputManifest 路徑可從 DescribeProjectVersion 回應中取得:

  • TrainingDataResult.Output.Assets[0].GroundTruthManifest.S3Object 用於訓練資料集

  • TestingDataResult.Output.Assets[0].GroundTruthManifest.S3Object 用於測試資料集

會針對「輸出資訊清單」中的每個項目傳回下列資訊:

Key Name Description
來源參考 Reference to an image in s3 that was provided in the input maniefst
內容管制-基本真相 Ground truth annotations that were provided in the input manifest
偵測管制-標籤 Adapter predictions, part of the testing dataset only
偵測管制-基於標籤的模型 Base model predictions, part of the testing dataset only

轉接器和基本模型預測會以 ConfidenceTrehsold 5.0 的格式,其格式類似於 DetectModerationLabel 回應。

下列範例顯示轉接器和基礎模型預測的結構:

{ "ModerationLabels": [ { "Confidence": number, "Name": "string", "ParentName": "string" } ], "ModerationModelVersion": "string", "ProjectVersion": "string" }

如需傳回標籤的完整清單,請參閱內容管制

評估結果資訊清單

訓練工作完成後,會傳回評估結果資訊清單檔案。評估結果資訊清單是訓練工作所輸出的 JSON 檔案,其中包含轉接器對測試資料執行情況的相關資訊。

Amazon S3 評估結果路徑資訊清單的 Amazon S3 路徑可從 DescribeProejctVersion 回應中的 EvaluationResult.Summary.S3Object 欄位取得。

下列範例說明評估結果的資訊清單檔案結構:

{ "AggregatedEvaluationResults": { "F1Score": number }, "EvaluationDetails": { "EvaluationEndTimestamp": "datetime", "Labels": [ "string" ], "NumberOfTestingImages": number, "NumberOfTrainingImages": number, "ProjectVersionArn": "string" }, "ContentModeration": { "InputConfidenceThresholdEvalResults": { "ConfidenceThreshold": float, "AggregatedEvaluationResults": { "BaseModel": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int }, "Adapter": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int } }, "LabelEvaluationResults": [ { "Label": "string", "BaseModel": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int }, "Adapter": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int } } ] } "AllConfidenceThresholdsEvalResults": [ { "ConfidenceThreshold": float, "AggregatedEvaluationResults": { "BaseModel": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int }, "Adapter": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int } }, "LabelEvaluationResults": [ { "Label": "string", "BaseModel": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int }, "Adapter": { "TruePositive": int, "TrueNegative": int, "FalsePositive": int, "FalseNegative": int } } ] } ] } }

評估資訊清單檔案包含:

  • F1Score 定義的彙總結果

  • 評估工作的詳細資料,包括 ProjectVersionArn、訓練映像數量、測試映像數量,以及轉接器訓練所在的標籤。

  • 針對基礎模型和轉接器效能的彙總 TruePositive、TrueNegative、FalsePositive 和 FalseNegative 結果。

  • 針對基礎模型和轉接器效能的每個標籤 TruePositive、TrueNegative、FalsePositive 和 FalseNegative 結果,根據輸入可信度閾值進行計算。

  • 在不同的可信度閾值下,針對基礎模型和轉接器效能的彙總和每個標籤 TruePositive、TrueNegative、FalsePositive 和 FalseNegative 結果。可信度閾值的範圍從 5 到 100,增值幅度為 5。