Bounding Box - 아마존 SageMaker

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

Bounding Box

기계 학습 모델을 훈련시키는 데 사용되는 이미지에는 둘 이상의 객체가 포함되어 있습니다. 이미지 내에서 하나 이상의 객체를 분류하고 현지화하려면 Amazon SageMaker Ground Truth 경계 상자 레이블 지정 작업 유형을 사용합니다. 이와 관련하여 현지화는 경계 상자의 픽셀 위치를 의미합니다.

Amazon SageMaker 콘솔의 Ground Truth 섹션 또는 CreateLabelingJob 작업을 경계 상자 레이블 지정 작업을 생성합니다.

중요

이 태스크 유형의 경우 고유한 매니페스트 파일을 생성하는 경우 "source-ref"를 사용하여 Amazon S3에서 레이블을 지정할 각 이미지의 위치를 파악합니다. 자세한 내용은 입력 데이터 섹션을 참조하세요.

경계 상자 레이블 지정 작업 생성(콘솔)

레이블 지정 작업 생성(콘솔) 지침에 따라 SageMaker 콘솔에서 경계 상자 레이블 지정 작업을 생성하는 방법을 학습할 수 있습니다. 10단계에서 작업 범주 드롭다운 메뉴에서 이미지를 선택하고 작업 유형으로 경계 상자를 선택합니다.

Ground Truth에서는 작업에 레이블을 지정할 때 다음과 유사한 작업자 UI를 제공합니다. 콘솔을 사용하여 레이블 지정 작업을 생성할 때 작업자가 작업을 완료하는 데 도움이 되는 지침과 작업자가 선택할 수 있는 레이블을 50개까지 지정합니다.

경계 상자 레이블 지정 작업 생성(API)

경계 상자 레이블 지정 작업을 생성하려면 SageMaker API 작업 CreateLabelingJob을 사용합니다. 이 API는 모든 AWS SDK에 대해 이 연산을 정의합니다. 이 작업에 지원되는 언어별 SDK 목록을 보려면 CreateLabelingJob관련 항목 섹션을 검토하십시오.

레이블 지정 작업 생성(API)의 지침에 따라 요청을 구성하는 동안 다음을 수행합니다.

  • 이 작업 유형에 대한 주석 전 Lambda 함수는 PRE-BoundingBox로 끝납니다. 사용자 리전의 주석 전 Lambda ARN을 찾으려면 PreHumanTaskLambdaArn을 참고하십시오.

  • 이 작업 유형에 대한 주석 통합 Lambda 함수는 ACS-BoundingBox로 끝납니다. 사용자 리전에 대한 주석 통합 Lambda ARN을 찾으려면 AnnotationConsolidationLambdaArn을 참고하십시오.

다음은 미국 동부(버지니아 북부) 리전에 레이블 지정 작업을 생성하는 AWS Python SDK(Boto3) 요청의 예제입니다. 빨간색으로 된 모든 파라미터는 사양과 리소스로 대체해야 합니다.

response = client.create_labeling_job( LabelingJobName='example-bounding-box-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-BoundingBox', 'TaskKeywords': [ 'Bounding Box', ], 'TaskTitle': 'Bounding Box task', 'TaskDescription': 'Draw bounding boxes around objects in an image', 'NumberOfHumanWorkersPerDataObject': 123, 'TaskTimeLimitInSeconds': 123, 'TaskAvailabilityLifetimeInSeconds': 123, 'MaxConcurrentTaskCount': 123, 'AnnotationConsolidationConfig': { 'AnnotationConsolidationLambdaArn': 'arn:aws:lambda:us-east-1:432418664414:function:ACS-BoundingBox' } }, Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )

경계 상자 레이블 지정 작업을 위한 템플릿 제공

API를 사용하여 레이블 지정 작업을 생성하는 경우 UiTemplateS3Uri의 작업자 태스크 템플릿을 제공해야 합니다. 다음 템플릿을 복사하고 수정합니다. short-instructions, full-instructionsheader만 수정합니다. 이 템플릿을 S3에 업로드하고 UiTemplateS3Uri에서 이 파일에 대한 S3 URI를 제공합니다.

<script src="https://assets.crowd.aws/crowd-html-elements.js"></script> <crowd-form> <crowd-bounding-box name="boundingBox" src="{{ task.input.taskObject | grant_read_access }}" header="please draw box" labels="{{ task.input.labels | to_json | escape }}" > <full-instructions header="Bounding box instructions"> <ol><li><strong>Inspect</strong> the image</li><li><strong>Determine</strong> if the specified label is/are visible in the picture.</li> <li><strong>Outline</strong> each instance of the specified label in the image using the provided “Box” tool.</li></ol> <ul><li>Boxes should fit tight around each object</li> <li>Do not include parts of the object are overlapping or that cannot be seen, even though you think you can interpolate the whole shape.</li> <li>Avoid including shadows.</li> <li>If the target is off screen, draw the box up to the edge of the image.</li> </full-instructions> <short-instructions> <h3><span style="color: rgb(0, 138, 0);">Good example</span></h3> <p>Enter description of a correct bounding box label and add images</p> <h3><span style="color: rgb(230, 0, 0);">Bad example</span></h3> <p>Enter description of an incorrect bounding box label and add images</p> </short-instructions> </crowd-bounding-box> </crowd-form>

경계 상자 출력 데이터

경계 상자 레이블 지정 작업을 생성하면 출력 데이터는 API 사용 시 S3OutputPath 파라미터에 지정된 Amazon S3 버킷 또는 콘솔의 작업 개요 섹션의 출력 데이터 세트 위치 필드에 있습니다.

예를 들어, 성공적으로 완료된 단일 클래스 경계 상자 작업의 출력 매니페스트 파일에는 다음이 포함됩니다.

[ { "boundingBox": { "boundingBoxes": [ { "height": 2832, "label": "bird", "left": 681, "top": 599, "width": 1364 } ], "inputImageProperties": { "height": 3726, "width": 2662 } } } ]

boundingBoxes 파라미터는 (0,0) 픽셀 좌표로 간주되는 이미지의 왼쪽 위 모서리를 기준으로 “새”로 식별되는 객체 주위에 그려진 경계 상자의 위치를 식별합니다. 앞의 예에서 lefttop은 이미지의 왼쪽 위 모서리를 기준으로 경계 상자의 왼쪽 위 모서리에 있는 픽셀 위치를 식별합니다. 경계 상자의 치수는 heightwidth로 식별됩니다. 이 inputImageProperties 파라미터는 원본 입력 이미지의 픽셀 크기를 제공합니다.

경계 상자 작업 유형을 사용하는 경우 단일 및 다중 클래스 경계 상자 레이블 지정 작업을 생성할 수 있습니다. 성공적으로 완료된 다중 클래스 경계 상자의 출력 매니페스트 파일에는 다음이 포함됩니다.

[ { "boundingBox": { "boundingBoxes": [ { "height": 938, "label": "squirrel", "left": 316, "top": 218, "width": 785 }, { "height": 825, "label": "rabbit", "left": 1930, "top": 2265, "width": 540 }, { "height": 1174, "label": "bird", "left": 748, "top": 2113, "width": 927 }, { "height": 893, "label": "bird", "left": 1333, "top": 847, "width": 736 } ], "inputImageProperties": { "height": 3726, "width": 2662 } } } ]

경계 상자 레이블 지정 작업의 결과인 출력 매니페스트 파일에 대한 자세한 내용은 경계 상자 작업 출력 단원을 참조하십시오.

Ground Truth에서 생성된 출력 매니페스트 파일 및 Ground Truth에서 출력 데이터 저장에 사용하는 파일 구조에 대한 자세한 내용은 출력 데이터을 참고하십시오.