本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
影片分類
當您需要工作人員使用您指定的預先定義標籤對影片進行分類時,請使用 Amazon SageMaker Ground Truth 視訊分類標籤任務。系統會向工作者顯示影片,並要求工作者為各個影片逐一選擇標籤。
您可以使用 Amazon SageMaker 主控台的「Ground Truth」區段或CreateLabelingJob操作建立視訊分類標籤任務。
您的影片檔案必須以標籤資料的工作團隊所使用的瀏覽器所支援的格式進行編碼。建議您使用工作者使用者介面預覽驗證您的輸入資訊清單檔案中的所有影片檔案格式是否正確顯示。您可以使用工作者指示,將支援的瀏覽器傳達給工作者。若要查看支援的檔案格式,請參閱支援的資料格式。
重要
對於此任務類型,如果您建立自己的資訊清單檔案,請使用 "source-ref"
來識別您要在 Amazon S3 標籤的每個影片檔案位置。如需詳細資訊,請參閱輸入資料。
建立影片分類標籤工作 (主控台)
您可以按照中的說明進行操作,建立標記任務 (主控台)以了解如何在 SageMaker 主控台中建立視訊分類標籤工作。在步驟 10 中,從任務類別下拉式清單中選擇影片,然後選擇影片分類做為任務類型。
Ground Truth 提供類似下列標籤任務的工作者使用者介面。在主控台中建立標籤工作時,您可以指定指示以協助工作者完成工作,以及工作者可以選擇的標籤。
建立視訊分類標籤 Job (API)
本節涵蓋使用 SageMaker API作業建立標籤工作時需要瞭解的詳細資訊CreateLabelingJob
。這API定義了所有的這個操作 AWS SDKs。若要查看此作業SDKs支援的特定語言清單,請檢閱的〈請參閱〉一節。CreateLabelingJob
設定請求時,請遵循建立標記任務 (API)上的指示並執行下列動作:
-
使用結尾為
PRE-VideoClassification
的註釋前 Lambda 函式。若要尋找您區域的預先註ARN解 Lambda,請參閱PreHumanTaskLambdaArn。 -
使用結尾為
ACS-VideoClassification
的註釋合併 Lambda 函式。若要尋找ARN適用於您區域的註釋合併 Lambda,請參閱。AnnotationConsolidationLambdaArn
以下是在美國東部 SDK(維吉尼亞北部) 區域建立標籤工作的AWS Python (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,則必須在中提供 Worker 任務範本UiTemplateS3Uri
。透過修改 short-instructions
、full-instructions
和 header
來複製並修改下列範本。將此範本上傳到 Amazon S3,並將 Amazon S3 提供URI給中的這個檔案UiTemplateS3Uri
。
<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>
影片分類輸出資料
建立視訊分類標籤 Job 務後,您的輸出資料會位於使用主控台「任務概觀」區段的「輸出資API料集位置」欄位時,在S3OutputPath
參數中指定的 Amazon S3 儲存貯體中。
若要進一步了解 Ground Truth 產生的輸出資訊清單檔案,以及 Ground Truth 用來儲存輸出資料的檔案結構,請參閱輸出資料。
若要檢視影片分類標籤工作的輸出資訊清單檔案範例,請參閱分類任務輸出。