Amazon A2I 输出数据 - Amazon SageMaker
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Amazon A2I 输出数据

当您的机器学习工作流程向 Amazon A2I 发送数据对象时,人类循环已创建并且人类审阅者会收到任务来查看该数据对象。每个人工审查任务的输出数据都存储在您在人工审核工作流程中指定的 Amazon Simple Storage Service (Amazon S3) 输出存储桶中。在数据的路径中,YYYY/MM/DD/hh/mm/ss用年代表人类循环创建日期(YYYY)、月 (MM),和天(DD),以及创建时间(以小时为单位)hh)、分钟 (mm),第二个(ss)。

s3://customer-output-bucket-specified-in-flow-definition/flow-definition-name/YYYY/MM/DD/hh/mm/ss/human-loop-name/output.json

输出数据的内容取决于任务类型(内置或自定义)和类型劳动力您使用。您的输出数据始终包括人工的响应。此外,输出数据可能包括有关人类循环、人类审阅者(工作人员)和数据对象的元数据。

有关 Amazon A2I 输出数据格式的更多信息,请参阅以下部分,以了解不同任务类型和人力的更多信息。

从内置任务类型输出数据

亚马逊 A2I 内置任务类型包括 Amazon Textract 和 Amazon Rekognition。除了人为反应之外,其中一项任务的输出数据还包括有关创建人类循环原因的详细信息以及用于创建人类循环的综合服务的详细信息。有关所有内置任务类型的输出数据架构的更多信息,请参阅下表。这些区域有:对于这些参数中的每个参数,都取决于您在 Amazon A2I 上使用的服务。有关这些服务特定值的详细信息,请参阅本节中的第二个表格。

参数 值类型 示例值 描述
awsManagedHumanLoopRequestSource

字符串

AWS/Rekognition/DetectModerationLabels/Image/V3 或者 AWS/Textract/AnalyzeDocument/Forms/V1 API 操作和关联Amazon要求亚马逊 A2I 创建人类循环的服务。这是您用来配置 Amazon A2I 人类循环的 API 操作。
flowDefinitionArn

字符串

arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name

用于创建人工循环的人工审核工作流程(流程定义)的 Amazon 资源编号 (ARN)。

humanAnswers

JSON 对象列表

{ "answerContent": { "AWS/Rekognition/DetectModerationLabels/Image/V3": { "moderationLabels": [...] } },
{ "answerContent": { "AWS/Textract/AnalyzeDocument/Forms/V1": { "blocks": [...] } },
包含工作人员响应的 JSON 对象列表answerContent.

此对象还包含提交详细信息以及(如果使用了私人劳动力)的员工元数据。要了解更多信息,请参阅 跟踪员工活动

对于来自 Amazon Rekognition 生成的人类循环输出数据DetectModerationLabel审阅任务,此参数仅包含积极回应。例如,如果工作人员选择没有内容,此回复不包括在内。

humanLoopName

字符串

'human-loop-name'

人工循环的名称。
inputContent

JSON 对象

{ "aiServiceRequest": {...}, "aiServiceResponse": {...}, "humanTaskActivationConditionResults": {...}, "selectedAiServiceResponse": {...} }

输入内容Amazon服务在亚马逊 A2I 请求创建人类循环时发送给该服务。

aiServiceRequest

JSON 对象

{ "document": {...}, "featureTypes": [...], "humanLoopConfig": {...} }
{ "image": {...}, "humanLoopConfig": {...} }

发送到的原始请求Amazon与 Amazon A2I 集成的服务。例如,如果您将 Amazon Rekognition 与亚马逊 A2I 结合使用,则包括通过 API 操作发出的请求DetectModerationLabels. 对于 Amazon Textract 集成,这包括通过AnalyzeDocument.

aiServiceResponse

JSON 对象

{ "moderationLabels": [...], "moderationModelVersion": "3.0" }

{ "blocks": [...], "documentMetadata": {} }

来自Amazon服务。这是用来确定是否需要人工审查的数据。此对象可能包含未与人工审阅者共享的有关数据对象的元数据。

selectedAiServiceResponse

JSON 对象

{ "moderationLabels": [...], "moderationModelVersion": "3.0" }

{ "blocks": [...], "documentMetadata": {} }

The subset of the aiServiceResponse匹配中的激活条件ActivationConditions.

中列出的所有数据对象aiServiceResponse列于selectedAiServiceResponse当推论被随机抽样时,或者所有推论都启动激活条件。

humanTaskActivationConditionResults

JSON 对象

{ "Conditions": [...] }

中的 JSON 对象inputContent这包含了创造人类循环的原因。这包括激活条件的列表(Conditions) 包含在人工审核工作流程(流程定义)中,以及每种情况的评估结果-此结果为true要么false. 要了解激活条件的更多信息,请参阅亚马逊中用于人 Augmented AI 循环激活条件的 JSON 架构.

在下表中选择一个选项卡以了解特定于任务类型的参数,并查看每种内置任务类型的示例输出数据代码块。

Amazon Textract Task Type Output Data

当您使用 Amazon Textract 内置集成时,您会看到'AWS/Textract/AnalyzeDocument/Forms/V1'作为的价值awsManagedHumanLoopRequestSource输出数据中。

这些区域有:answerContent参数包含Block对象,其中包括发送给 Amazon A2I 的所有区块的人类响应。

这些区域有:aiServiceResponse参数还包括Block对象,其中包含亚马逊 Textract 对原始请求的响应AnalyzeDocument.

要了解有关在块对象中看到的参数的更多信息,请参阅Block中的Amazon Textract 开发人员指南.

以下是亚马逊 A2I 人工评论对 Amazon Textract 文档分析推断的输出数据的示例。

{ "awsManagedHumanLoopRequestSource": "AWS/Textract/AnalyzeDocument/Forms/V1", "flowDefinitionArn": "arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name", "humanAnswers": [ { "answerContent": { "AWS/Textract/AnalyzeDocument/Forms/V1": { "blocks": [...] } }, "submissionTime": "2020-09-28T19:17:59.880Z", "workerId": "111122223333", "workerMetadata": { "identityData": { "identityProviderType": "Cognito", "issuer": "https://cognito-idp.us-west-2.amazonaws.com/us-west-2_111111", "sub": "c6aa8eb7-9944-42e9-a6b9-111122223333" } } } ], "humanLoopName": "humnan-loop-name", "inputContent": { "aiServiceRequest": { "document": { "s3Object": { "bucket": "DOC-EXAMPLE-BUCKET1", "name": "document-demo.jpg" } }, "featureTypes": [ "TABLES", "FORMS" ], "humanLoopConfig": { "dataAttributes": { "contentClassifiers": [ "FreeOfPersonallyIdentifiableInformation" ] }, "flowDefinitionArn": "arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name", "humanLoopName": "humnan-loop-name" } }, "aiServiceResponse": { "blocks": [...], "documentMetadata": { "pages": 1 } }, "humanTaskActivationConditionResults": { "Conditions": [ { "EvaluationResult": true, "Or": [ { "ConditionParameters": { "ImportantFormKey": "Mail address", "ImportantFormKeyAliases": [ "Mail Address:", "Mail address:", "Mailing Add:", "Mailing Addresses" ], "KeyValueBlockConfidenceLessThan": 100, "WordBlockConfidenceLessThan": 100 }, "ConditionType": "ImportantFormKeyConfidenceCheck", "EvaluationResult": true }, { "ConditionParameters": { "ImportantFormKey": "Mail address", "ImportantFormKeyAliases": [ "Mail Address:", "Mail address:", "Mailing Add:", "Mailing Addresses" ] }, "ConditionType": "MissingImportantFormKey", "EvaluationResult": false } ] } ] }, "selectedAiServiceResponse": { "blocks": [...] } } }
Amazon Rekognition Task Type Output Data

当您使用 Amazon Textract 内置集成时,您会看到字符串'AWS/Rekognition/DetectModerationLabels/Image/V3'作为的价值awsManagedHumanLoopRequestSource输出数据中。

这些区域有:answerContent参数包含moderationLabels对象,其中包含针对发送至 Amazon A2I 的所有审核标签的人类响应。

这些区域有:aiServiceResponse参数还包括moderationLabels反映亚马逊 Rekognition 对发送至的原始请求的响应DetectModerationLabels.

要了解有关在块对象中看到的参数的更多信息,请参阅ModerationLabel在 Amazon Rekognition 开发人员指南中。

以下是亚马逊 A2I 人类评论对 Amazon Rekognition 图像审核推断的输出数据的示例。

{ "awsManagedHumanLoopRequestSource": "AWS/Rekognition/DetectModerationLabels/Image/V3", "flowDefinitionArn": "arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name", "humanAnswers": [ { "answerContent": { "AWS/Rekognition/DetectModerationLabels/Image/V3": { "moderationLabels": [...] } }, "submissionTime": "2020-09-28T19:22:35.508Z", "workerId": "ef7294f850a3d9d1", "workerMetadata": { "identityData": { "identityProviderType": "Cognito", "issuer": "https://cognito-idp.us-west-2.amazonaws.com/us-west-2_111111", "sub": "c6aa8eb7-9944-42e9-a6b9-111122223333" } } } ], "humanLoopName": "humnan-loop-name", "inputContent": { "aiServiceRequest": { "humanLoopConfig": { "flowDefinitionArn": "arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name", "humanLoopName": "humnan-loop-name" }, "image": { "s3Object": { "bucket": "DOC-EXAMPLE-BUCKET1", "name": "example-image.jpg" } } }, "aiServiceResponse": { "moderationLabels": [...], "moderationModelVersion": "3.0" }, "humanTaskActivationConditionResults": { "Conditions": [ { "EvaluationResult": true, "Or": [ { "ConditionParameters": { "ConfidenceLessThan": 98, "ModerationLabelName": "Suggestive" }, "ConditionType": "ModerationLabelConfidenceCheck", "EvaluationResult": true }, { "ConditionParameters": { "ConfidenceGreaterThan": 98, "ModerationLabelName": "Female Swimwear Or Underwear" }, "ConditionType": "ModerationLabelConfidenceCheck", "EvaluationResult": false } ] } ] }, "selectedAiServiceResponse": { "moderationLabels": [ { "confidence": 96.7122802734375, "name": "Suggestive", "parentName": "" } ], "moderationModelVersion": "3.0" } } }

输出自定义任务类型的数据

当您将 Amazon A2I 添加到自定义人工审核工作流程时,您会在人工审核任务返回的输出数据中看到以下参数。

参数 值类型 描述

flowDefinitionArn

字符串

用于创建人工循环的人工审核工作流程(流程定义)的 Amazon 资源编号 (ARN)。

humanAnswers

JSON 对象列表

包含工作人员响应的 JSON 对象列表answerContent. 此参数中的值取决于从您的Worker 任务模板.

如果您使用的是私人劳动力,则包括员工元数据。要了解更多信息,请参阅 跟踪员工活动

humanLoopName

字符串 人工循环的名称。

inputContent

JSON 对象

请求中发送给亚马逊 A2I 的输入内容StartHumanLoop.

以下是与 Amazon A2I 和 Amazon Transcribe 的自定义集成的输出数据的示例。在此示例中,inputContent包含以下内容:

  • Amazon S3 中 .mp4 文件的路径和视频标题

  • 从亚马逊 Transcribe 返回的转录(从 Amazon Transcribe 输出数据中解析)

  • 工作人员任务模板用于裁剪 .mp4 文件并向工作人员显示视频的相关部分的开始和结束时间

{ "flowDefinitionArn": "arn:aws:sagemaker:us-west-2:111122223333:flow-definition/flow-definition-name", "humanAnswers": [ { "answerContent": { "transcription": "use lambda to turn your notebook" }, "submissionTime": "2020-06-18T17:08:26.246Z", "workerId": "ef7294f850a3d9d1", "workerMetadata": { "identityData": { "identityProviderType": "Cognito", "issuer": "https://cognito-idp.us-west-2.amazonaws.com/us-west-2_111111", "sub": "c6aa8eb7-9944-42e9-a6b9-111122223333" } } } ], "humanLoopName": "human-loop-name", "inputContent": { "audioPath": "s3://DOC-EXAMPLE-BUCKET1/a2i_transcribe_demo/Fully-Managed Notebook Instances with Amazon SageMaker - a Deep Dive.mp4", "end_time": 950.27, "original_words": "but definitely use Lambda to turn your ", "start_time": 948.51, "video_title": "Fully-Managed Notebook Instances with Amazon SageMaker - a Deep Dive.mp4" } }

跟踪员工活动

Amazon A2I 提供的信息可用于跟踪任务输出数据中的个人员。要识别执行人工审查任务的工作人员,请使用 Amazon S3 中输出数据中的以下内容:

  • 这些区域有:acceptanceTime是工作人员接受任务的时间。此日期和时间戳的格式为YYYY-MM-DDTHH:MM:SS.mmmZ为年份 (YYYY)、月 (MM)、天 (DD)、小时 (HH)、分钟 (MM), 第二 (SS),和毫秒(mmm)。日期和时间由T.

  • 这些区域有:submissionTime是工作人员使用提交按钮。此日期和时间戳的格式为YYYY-MM-DDTHH:MM:SS.mmmZ为年份 (YYYY)、月 (MM)、天 (DD)、小时 (HH)、分钟 (MM), 第二 (SS),和毫秒(mmm)。日期和时间由T.

  • timeSpentInSeconds报告工作人员积极处理该任务的总时间(以秒为单位)。此指标不包括工作人员暂停或休息的时间。

  • workerId 对于每个工作人员都是唯一的。

  • 如果您使用私有人力,在workerMetadata,您将看到以下内容。

    • 这些区域有:identityProviderType是用于管理私有人力的服务。

    • 这些区域有:issuer与分配给此人工审核任务的工作团队关联的 Amazon Cognito 用户池或 OpenID Connect (OIDC) 身份提供商 (IdP) 发行人工。

    • 唯一sub标识符指工作人员。如果您使用 Amazon Cognito 创建人力,您可以使用 Amazon Cognito 检索与此 ID 关联的此工作人员的详细信息(如姓名或用户名)。要了解如何操作,请参阅管理和搜索用户账户Amazon Cognito 开发人员指南.

以下是您在使用 Amazon Cognito 创建私有人力时可能看到的输出示例。这在identityProviderType.

"submissionTime": "2020-12-28T18:59:58.321Z", "acceptanceTime": "2020-12-28T18:59:15.191Z", "timeSpentInSeconds": 40.543, "workerId": "a12b3cdefg4h5i67", "workerMetadata": { "identityData": { "identityProviderType": "Cognito", "issuer": "https://cognito-idp.aws-region.amazonaws.com/aws-region_123456789", "sub": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" } }

以下是如果您使用自己的 OIDC IdP 来创建私人劳动力,您可能会看到的输出示例:

"workerMetadata": { "identityData": { "identityProviderType": "Oidc", "issuer": "https://example-oidc-ipd.com/adfs", "sub": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" } }

要了解有关使用私有人力的更多信息,请参阅使用私有人力.