HTML, 매니페스트 및 JSON 파일을 Amazon Simple Storage Service(Amazon S3)에 업로드합니다. 예:
import boto3import os
bucket = 'awsdoc-example-bucket'
prefix = 'GroundTruthCustomUI'
boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'customUI.html')).upload_file('customUI.html')
boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'input.manifest')).upload_file('input.manifest')
boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'testLabels.json')).upload_file('testLabels.json')
레이블 지정 작업을 만들려면 boto3과 같은 AWS SDK를 사용합니다.
import boto3
client = boto3.client("sagemaker")
client.create_labeling_job(
LabelingJobName="SemanticSeg-CustomUI",
LabelAttributeName="output-ref",
InputConfig={
"DataSource": {"S3DataSource": {"ManifestS3Uri": "INPUT_MANIFEST_IN_S3"}},
"DataAttributes": {
"ContentClassifiers": [
"FreeOfPersonallyIdentifiableInformation",
]
},
},
OutputConfig={"S3OutputPath": "S3_OUTPUT_PATH"},
RoleArn="IAM_ROLE_ARN",
LabelCategoryConfigS3Uri="LABELS_JSON_FILE_IN_S3",
StoppingConditions={"MaxPercentageOfInputDatasetLabeled": 100},
HumanTaskConfig={
"WorkteamArn": "WORKTEAM_ARN",
"UiConfig": {"UiTemplateS3Uri": "HTML_TEMPLATE_IN_S3"},
"PreHumanTaskLambdaArn": "arn:aws:lambda:eu-west-1:111122223333:function:PRE-SemanticSegmentation",
"TaskKeywords": [
"SemanticSegmentation",
],
"TaskTitle": "Semantic Segmentation",
"TaskDescription": "Draw around the specified labels using the tools",
"NumberOfHumanWorkersPerDataObject": 1,
"TaskTimeLimitInSeconds": 3600,
"TaskAvailabilityLifetimeInSeconds": 1800,
"MaxConcurrentTaskCount": 1,
"AnnotationConsolidationConfig": {
"AnnotationConsolidationLambdaArn": "arn:aws:lambda:eu-west-1:111122223333:function:ACS-SemanticSegmentation"
},
},
Tags=[{"Key": "reason", "Value": "CustomUI"}],
)