示例:使用 SageMaker API 创建流式标注 Job - Amazon SageMaker
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

示例:使用 SageMaker API 创建流式标注 Job

以下是一个 Amazon Python SDK (Boto3) 请求示例,您可以使用该请求在美国东部(弗吉尼亚州北部)区域为内置任务类型启动流式标注作业。有关以下每个参数的更多详细信息,请参阅 CreateLabelingJob。要了解如何使用此 API 和相关特定于语言的 SDK 创建标注作业,请参阅创建标注作业 (API)

在此示例中,请注意以下参数:

  • SnsDataSource – 此参数出现在 InputConfigOutputConfig 中,分别用于标识输入和输出 Amazon SNS 主题。要创建流式标注作业,您需要提供 Amazon SNS 输入主题。您还可以选择提供 Amazon SNS 输出主题。

  • S3DataSource – 此参数为可选参数。如果您想在标注作业开始后立即包括要标注的数据对象的输入清单文件,请使用此参数。

  • StoppingConditions – 创建流式标注作业时,将忽略此参数。要了解有关停止流式标注作业的更多信息,请参阅停止流式标注作业

  • 流式标注作业不支持自动数据标注。不要包括 LabelingJobAlgorithmsConfig 参数。

response = client.create_labeling_job( LabelingJobName= 'example-labeling-job', LabelAttributeName='label', InputConfig={ 'DataSource': { 'S3DataSource': { 'ManifestS3Uri': 's3://bucket/path/manifest-with-input-data.json' }, 'SnsDataSource': { 'SnsTopicArn': 'arn:aws:sns:us-east-1:123456789012:your-sns-input-topic' } }, 'DataAttributes': { 'ContentClassifiers': [ 'FreeOfPersonallyIdentifiableInformation'|'FreeOfAdultContent', ] } }, OutputConfig={ 'S3OutputPath': 's3://bucket/path/file-to-store-output-data', 'KmsKeyId': 'string', 'SnsTopicArn': 'arn:aws:sns:us-east-1:123456789012:your-sns-output-topic' }, RoleArn='arn:aws:iam::*:role/*', LabelCategoryConfigS3Uri='s3://bucket/path/label-categories.json', HumanTaskConfig={ 'WorkteamArn': 'arn:aws:sagemaker:us-east-1:*:workteam/private-crowd/*', 'UiConfig': { 'UiTemplateS3Uri': 's3://bucket/path/custom-worker-task-template.html' }, 'PreHumanTaskLambdaArn': 'arn:aws:lambda:us-east-1:432418664414:function:PRE-tasktype', 'TaskKeywords': [ 'Example key word', ], 'TaskTitle': 'Multi-label image classification task', 'TaskDescription': 'Select all labels that apply to the images shown', 'NumberOfHumanWorkersPerDataObject': 123, 'TaskTimeLimitInSeconds': 123, 'TaskAvailabilityLifetimeInSeconds': 123, 'MaxConcurrentTaskCount': 123, 'AnnotationConsolidationConfig': { 'AnnotationConsolidationLambdaArn': 'arn:aws:lambda:us-east-1:432418664414:function:ACS-tasktype' } }, Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )