本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
如果您需要工作人员使用您指定的预定义标签对视频进行分类,请使用 Amazon G SageMaker round Truth 视频分类标注任务。将向工作人员显示视频,并要求工作人员为每个视频选择一个标签。您可以使用 Amazon A SageMaker I 控制台的 Ground Truth 部分或CreateLabelingJob操作创建视频分类标签任务。
您的视频文件必须以标注数据的工作团队所使用的浏览器支持的格式编码。建议您使用工作人员 UI 预览来验证输入清单文件中的所有视频文件格式是否正确显示。您可以使用工作人员说明将受支持的浏览器传达给工作人员。要查看支持的文件格式,请参阅支持的数据格式。
重要
对于此任务类型,如果您创建自己的清单文件,请使用 "source-ref"
识别 Amazon S3 中您要标注的每个视频文件的位置。有关更多信息,请参阅 输入数据。
创建视频分类标注作业(控制台)
您可以按照中的说明学习创建标注作业(控制台)如何在 SageMaker AI 控制台中创建视频分类标注作业。在步骤 10 中,从任务类别下拉列表中选择视频,然后选择视频分类作为任务类型。
Ground Truth 为标注任务提供类似于以下内容的工作人员 UI。在控制台中创建标注作业时,需要指定说明,以便于工作人员完成工作人员可以从中选择的作业和标签。

创建视频分类标注作业 (API)
本节介绍了使用 SageMaker API 操作 CreateLabelingJob
创建标记作业时需要了解的详细信息。此 API 为所有人定义了此操作 AWS SDKs。要查看此操作 SDKs 支持的特定语言列表,请查看的 “另请参阅” 部分。CreateLabelingJob
请按照创建标注作业 (API)中的说明进行操作,并在配置请求时执行以下操作:
-
使用以
PRE-VideoClassification
结尾的注释前 Lambda 函数。要查找您所在地区的预注释 Lambda ARN,请参阅。PreHumanTaskLambdaArn -
使用以
ACS-VideoClassification
结尾的注释合并 Lambda 函数。要查找您所在地区的注释合并 Lambda ARN,请参阅。AnnotationConsolidationLambdaArn
以下是一个 AWS Python SDK (Boto3) 请求
response = client.create_labeling_job( LabelingJobName=
'example-video-classification-labeling-job
, LabelAttributeName='label'
, InputConfig={ 'DataSource': { 'S3DataSource': { 'ManifestS3Uri':'s3://bucket/path/manifest-with-input-data.json'
} }, 'DataAttributes': { 'ContentClassifiers': ['FreeOfPersonallyIdentifiableInformation'|'FreeOfAdultContent'
, ] } }, OutputConfig={ 'S3OutputPath':'s3://bucket/path/file-to-store-output-data'
, 'KmsKeyId':'string'
}, RoleArn='arn:aws:iam::*:role/*
, LabelCategoryConfigS3Uri='s3://bucket/path/label-categories.json'
, StoppingConditions={ 'MaxHumanLabeledObjectCount':123
, 'MaxPercentageOfInputDatasetLabeled':123
}, HumanTaskConfig={ 'WorkteamArn':'arn:aws:sagemaker:region:*:workteam/private-crowd/*'
, 'UiConfig': { 'UiTemplateS3Uri':'s3://bucket/path/worker-task-template.html'
}, 'PreHumanTaskLambdaArn': 'arn:aws:lambda:us-east-1:432418664414
:function:PRE-VideoClassification', 'TaskKeywords': ['Video Classification'
, ], 'TaskTitle':'Video classification task'
, 'TaskDescription':'Select a label to classify this video'
, 'NumberOfHumanWorkersPerDataObject':123
, 'TaskTimeLimitInSeconds':123
, 'TaskAvailabilityLifetimeInSeconds':123
, 'MaxConcurrentTaskCount':123
, 'AnnotationConsolidationConfig': { 'AnnotationConsolidationLambdaArn': 'arn:aws:lambda:us-east-1:432418664414
:function:ACS-VideoClassification' }, Tags=[ { 'Key':'string'
, 'Value':'string'
}, ] )
为视频分类提供模板
如果要使用 API 创建标注作业,必须在 UiTemplateS3Uri
中提供工作人员任务模板。通过修改 short-instructions
、full-instructions
和 header
来复制和修改以下模板。将此模板上传到 Amazon S3,并在 UiTemplateS3Uri
中为此文件提供 Amazon S3 URI。
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>
<crowd-form>
<crowd-classifier
name="crowd-classifier"
categories="{{ task.input.labels | to_json | escape }}"
header="Please classify video"
>
<classification-target>
<video width="100%" controls/>
<source src="{{ task.input.taskObject | grant_read_access }}" type="video/mp4"/>
<source src="{{ task.input.taskObject | grant_read_access }}" type="video/webm"/>
<source src="{{ task.input.taskObject | grant_read_access }}" type="video/ogg"/>
Your browser does not support the video tag.
</video>
</classification-target>
<full-instructions header="Video classification instructions">
<ol><li><strong>Read</strong> the task carefully and inspect the video.</li>
<li><strong>Read</strong> the options and review the examples provided to understand more about the labels.</li>
<li><strong>Choose</strong> the appropriate label that best suits the video.</li></ol>
</full-instructions>
<short-instructions>
<h3><span style="color: rgb(0, 138, 0);">Good example</span></h3>
<p>Enter description to explain the correct label to the workers</p>
<p><img src="https://d7evko5405gb7.cloudfront.net/fe4fed9b-660c-4477-9294-2c66a15d6bbe/src/images/quick-instructions-example-placeholder.png" style="max-width:100%"></p>
<h3><span style="color: rgb(230, 0, 0);">Bad example</span></h3>
<p>Enter description of an incorrect label</p>
<p><img src="https://d7evko5405gb7.cloudfront.net/fe4fed9b-660c-4477-9294-2c66a15d6bbe/src/images/quick-instructions-example-placeholder.png" style="max-width:100%"></p>
</short-instructions>
</crowd-classifier>
</crowd-form>
视频分类输出数据
创建视频分类标注作业后,输出数据将位于使用 API 时在 S3OutputPath
参数中指定的 Amazon S3 存储桶中,或者位于控制台的作业概览部分的输出数据集位置字段中。
要了解有关 Ground Truth 生成的输出清单文件以及 Ground Truth 用来存储输出数据的文件结构的更多信息,请参阅标注作业输出数据。
要查看视频分类标注作业的输出清单文件示例,请参阅分类作业输出。