動画分類 - Amazon SageMaker

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

動画分類

指定した定義済みラベルを使用してワーカーが動画を分類する必要がある場合は、Amazon SageMaker Ground Truth の動画分類ラベル付けタスクを使用します。ワーカーに動画が表示され、動画ごとに 1 つのラベルを選択するように求められます。

Amazon SageMaker コンソールの Ground Truth セクションまたは CreateLabelingJobオペレーションを使用して、動画分類ラベル付けジョブを作成します。

動画ファイルは、データにラベルを付ける作業チームが使用するブラウザでサポートされている形式でエンコードする必要があります。ワーカー UI プレビューを使用して、入力マニフェストファイル内のすべての動画ファイル形式が正しく表示されることを確認することをお勧めします。ワーカー向け指示書を使用して、サポートされているブラウザをワーカーに指示できます。サポートされているファイル形式については、「サポートされている日付書式」を参照してください。

重要

このタスクタイプでは、独自のマニフェストファイルを作成する場合、"source-ref" を使用して、ラベル付けする Amazon S3 内の各動画ファイルの場所を特定します。詳細については、「入力データ」を参照してください。

動画分類ラベル付けジョブを作成する (コンソール)

「」の手順に従ってラベル付けジョブの作成 (コンソール)、 SageMaker コンソールで動画分類ラベル付けジョブを作成する方法について説明します。ステップ 10 で、[Task category] (タスクカテゴリ) ドロップダウンメニューから [Video] (動画) を選択し、[Video Classification ] (動画分類) タスクタイプを指定します。

Ground Truth には、ラベル付けタスク用の次のようなワーカー UI が用意されています。コンソールでラベル付けジョブを作成するときは、ワーカーがジョブを実行できる手順と、ワーカーが選択できるラベルを指定します。

動画分類ラベル付けジョブを作成する (API)

このセクションでは、 SageMaker の API オペレーション CreateLabelingJob を使用してラベル付けジョブを作成する場合に知っておく必要のある詳細情報について説明します。この API は、すべての AWS SDKsに対してこのオペレーションを定義します。このオペレーションでサポートされている言語固有の SDK のリストを確認するには、CreateLabelingJob の「以下の資料も参照してください」セクションを確認してください。

リクエストを設定する際には、「ラベル付けジョブを作成 (API)」の指示に従ったうえで、以下のことを実行してください。

  • PRE-VideoClassification で終わる注釈前 Lambda 関数を使用します。リージョンの注釈前 Lambda ARN を確認するには、「」を参照してくださいPreHumanTaskLambdaArn

  • ACS-VideoClassification で終わる 注釈統合 Lambda 関数を使用します。リージョンの注釈統合 Lambda ARN を確認するには、「」を参照してくださいAnnotationConsolidationLambdaArn

以下は、米国東部 (バージニア北部) リージョンでラベル付けジョブを作成する AWS Python SDK (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 を使用してラベル付けジョブを作成する場合は、UiTemplateS3Uri でワーカータスクテンプレートを指定する必要があります。次のテンプレートをコピーし、short-instructionsfull-instructionsheader を修正して変更します。このテンプレートを Amazon S3 にアップロードし、UiTemplateS3Uri で、このファイルに Amazon S3 URI を指定します。

<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>

動画分類出力データ

動画分類のラベル付けジョブを作成すると、出力データは、APIを使用するときに S3OutputPath パラメータで指定された Amazon S3 バケット、またはコンソールの [Job overview] (ジョブの概要)セクションの [Output dataset location] (出力データセットの場所) フィールドに配置されます。

Ground Truth によって生成される出力マニフェストファイルと、Ground Truth が出力データを保存するために使用するファイル構造の詳細については、「出力データ」を参照してください。

動画分類ラベル付けジョブの出力マニフェストファイルの例については、「分類ジョブの出力」を参照してください。