利用API启动AWS Groun TruthLabeling Jobs

周伟泽
2023-12-01
client = boto3.client('sagemaker')
    response = client.create_labeling_job(
        LabelingJobName='example-video-od-labeling-job-1',
        LabelAttributeName='mylabel-ref',
        InputConfig={
            'DataSource': {
                'S3DataSource': {
                    'ManifestS3Uri': 's3://bucket/videos/dataset-20220829T79.manifest'
                }
            },
            'DataAttributes': {
                'ContentClassifiers': [
                    'FreeOfAdultContent'
                ]
            }
        },
        OutputConfig={
            'S3OutputPath': 's3://bucket/videos/'
        },
        RoleArn="arn of your role",
        LabelCategoryConfigS3Uri="s3://bucket/label_category_config.json",  # Todo: find a correct one
        StoppingConditions={
            # 'MaxHumanLabeledObjectCount': 123,
            'MaxPercentageOfInputDatasetLabeled': 100
        },
        HumanTaskConfig={
            'WorkteamArn': "arn of worker",
            'UiConfig': {
                'HumanTaskUiArn': 'arn:aws:sagemaker:us-west-2:394669845002:human-task-ui/VideoObjectDetection'
            },
            'PreHumanTaskLambdaArn': 'arn:aws:lambda:us-west-2:081040173940:function:PRE-VideoObjectDetection',
                #  'arn:aws:lambda:us-east-1:432418664414:function:PRE-VideoObjectDetection',
            'TaskKeywords': [
                'Image Object Detection',
            ],
            'TaskTitle': 'video frame object detection task',
            'TaskDescription': 'Classify and identify the location of objects and people in video frames',
            'NumberOfHumanWorkersPerDataObject': 8,
            'TaskTimeLimitInSeconds': 3600,
            'TaskAvailabilityLifetimeInSeconds': 36000,
            'MaxConcurrentTaskCount': 123,
            'AnnotationConsolidationConfig': {
                'AnnotationConsolidationLambdaArn': 'arn:aws:lambda:us-west-2:081040173940:function:ACS-VideoObjectDetection'
            }
         }
    )

API Reference:

Labeling Category Configuration File

 类似资料: