동작 인식용 동영상 학습 데이터 준비

이 페이지에서는 동영상 동작 인식 모델을 학습시키기 위해 Vertex AI 데이터 세트에서 사용할 동영상 학습 데이터를 준비하는 방법을 설명합니다.

다음 섹션에서는 데이터 요구사항, 스키마 파일, 스키마에서 정의된 데이터 가져오기 파일(JSONL 및 CSV)의 형식에 대한 정보를 제공합니다.

또는 주석 처리되지 않은 동영상을 가져와 나중에 Google Cloud 콘솔을 통해 주석 처리할 수도 있습니다(Google Cloud 콘솔을 사용하여 라벨 지정 참고).

데이터 요구사항

다음 요구사항은 AutoML 또는 커스텀 학습 모델을 학습시키는 데 사용되는 데이터 세트에 적용됩니다.

  • Vertex AI는 모델을 학습시키거나 예측을 요청할 때(동영상에 주석 달기) 다음과 같은 동영상 형식을 지원합니다.

    • .MOV
    • .MPEG4
    • .MP4
    • .AVI
  • 웹 콘솔에서 동영상 콘텐츠를 보거나 동영상에 주석을 추가하려면 동영상이 브라우저에서 기본적으로 지원하는 형식이어야 합니다. 모든 브라우저에서 기본적으로 .MOV 또는 .AVI 콘텐츠를 처리하지 않으므로 .MPEG4 또는 .MP4 동영상 형식을 사용하는 것이 좋습니다.

  • 최대 파일 크기는 50GB입니다(최대 재생 시간 3시간). 컨테이너에 잘못된 또는 비어 있는 타임스탬프가 포함된 개별 동영상 파일은 지원되지 않습니다.

  • 각 데이터 세트의 최대 라벨 수는 1,000개로 제한되어 있습니다.

  • 가져오기 파일의 동영상에 'ML_USE' 라벨을 할당할 수 있습니다. 학습 시에는 이러한 라벨을 사용하여 동영상과 해당 주석을 '학습' 또는 '테스트' 세트로 분할할 수 있습니다. 동작 인식의 경우 VAR 라벨 지정 콘솔을 사용할 때 제한사항이 있으므로 라벨링 도구를 사용하여 작업에 라벨을 지정하려면 해당 동영상의 모든 작업에 라벨을 지정해야 합니다.

AutoML 모델 학습에 사용되는 동영상 데이터 권장사항

다음 모델은 AutoML 모델을 학습시키는 데 사용되는 데이터 세트에 적용됩니다.

  • 학습 데이터는 예측을 수행할 데이터와 최대한 유사해야 합니다. 예를 들어 사용 사례에 보안 카메라 영상처럼 흐릿한 저해상도 동영상이 포함된다면 학습 데이터도 흐릿한 저해상도 동영상으로 구성해야 합니다. 또한 일반적으로 다양한 각도, 해상도, 배경으로 촬영한 학습 동영상을 제공하는 것이 좋습니다.

  • 인간이 지정할 수 없는 라벨은 Vertex AI 모델도 일반적으로 예측할 수 없습니다. 만일 동영상을 1~2초 보고 라벨을 지정하도록 사람을 학습시킬 수 없다면 이 모델도 그렇게 하도록 학습시킬 수 없습니다.

  • 가장 흔한 라벨의 동영상이 가장 흔하지 않은 라벨의 동영상보다 최대 100배 많을 때 모델의 성능이 가장 좋습니다. 빈도가 낮은 라벨을 삭제하는 것이 좋습니다. 동작 인식에서는 다음 사항에 유의하세요.

    • 라벨당 학습 동영상 프레임 100개 이상을 사용하는 것이 좋습니다.
    • 동영상 프레임 해상도가 1024픽셀 x 1024픽셀보다 훨씬 높을 경우 Vertex AI 프레임 정규화 과정 중에 일부 이미지 품질이 손실될 수 있습니다.

스키마 파일

  • 주석을 가져오기 위한 JSONL 파일을 만들 때 공개적으로 액세스할 수 있는 다음 스키마 파일을 사용합니다. 이 스키마 파일은 데이터 입력 파일의 형식을 지정합니다. 파일 구조는 OpenAPI 스키마 테스트를 따릅니다.

    동작 인식 스키마 파일:

    gs://google-cloud-aiplatform/schema/dataset/ioformat/video_action_recognition_io_format_1.0.0.yaml

    전체 스키마 파일

    
    title: VideoActionRecognition
    description: >
      Import and export format for importing/exporting videos together with
      action recognition annotations with time segment. Can be used in
      Dataset.import_schema_uri field.
    type: object
    required:
    - videoGcsUri
    properties:
      videoGcsUri:
        type: string
        description: >
          A Cloud Storage URI pointing to a video. Up to 50 GB in size and
          up to 3 hours in duration. Supported file mime types: `video/mp4`,
          `video/avi`, `video/quicktime`.
      timeSegments:
        type: array
        description: Multiple fully-labeled segments.
        items:
          type: object
          description: A time period inside the video.
          properties:
            startTime:
              type: string
              description: >
                The start of the time segment. Expressed as a number of seconds as
                measured from the start of the video, with "s" appended at the end.
                Fractions are allowed, up to a microsecond precision.
              default: 0s
            endTime:
              type: string
              description: >
                The end of the time segment. Expressed as a number of seconds as
                measured from the start of the video, with "s" appended at the end.
                Fractions are allowed, up to a microsecond precision, and "Infinity"
                is allowed, which corresponds to the end of the video.
              default: Infinity
      timeSegmentAnnotations:
        type: array
        description: >
          Multiple action recognition annotations. Each on a time segment of the video.
        items:
          type: object
          description: Annotation with a time segment on media (e.g., video).
          properties:
            displayName:
              type: string
              description: >
                It will be imported as/exported from AnnotationSpec's display name.
            startTime:
              type: string
              description: >
                The start of the time segment. Expressed as a number of seconds as
                measured from the start of the video, with "s" appended at the end.
                Fractions are allowed, up to a microsecond precision.
              default: 0s
            endTime:
              type: string
              description: >
                The end of the time segment. Expressed as a number of seconds as
                measured from the start of the video, with "s" appended at the end.
                Fractions are allowed, up to a microsecond precision, and "Infinity"
                is allowed, which means the end of the video.
              default: Infinity
            annotationResourceLabels:
              description: Resource labels on the Annotation.
              type: object
              additionalProperties:
                type: string
      dataItemResourceLabels:
        description: Resource labels on the DataItem. Overrides values set in
          ImportDataConfig at import time. Can set a user-defined label
          or the predefined `aiplatform.googleapis.com/ml_use` label, which is
          used to determine the data split and can be set to `training` and `test`.
        type: object
        additionalProperties:
          type: string

입력 파일

동영상 동작 인식을 위한 학습 데이터의 형식은 다음과 같습니다.

데이터를 가져오려면 JSONL 또는 CSV 파일을 만듭니다.

JSONL

각 줄의 JSON:
자세한 내용은 동작 인식 YAML 파일을 참조하세요.
참고: 여기서 작업 타임스탬프를 계산하는 데 시간 세그먼트가 사용됩니다. timeSegmentAnnotationsstartTimeendTime은 동일할 수 있으며 동작의 키 프레임에 해당합니다.


{
  "videoGcsUri': "gs://bucket/filename.ext",
  "timeSegments": [{
    "startTime": "start_time_of_fully_annotated_segment",
    "endTime": "end_time_of_segment"}],
  "timeSegmentAnnotations": [{
    "displayName": "LABEL",
    "startTime": "start_time_of_segment",
    "endTime": "end_time_of_segment"
  }],
  "dataItemResourceLabels": {
    "ml_use": "train|test"
  }
}

JSONL 예시 - 동영상 작업 인식:


{"videoGcsUri": "gs://demo/video1.mp4", "timeSegmentAnnotations": [{"displayName": "cartwheel", "startTime": "1.0s", "endTime": "12.0s"}], "dataItemResourceLabels": {"ml_use": "training"}}
{"videoGcsUri": "gs://demo/video2.mp4", "timeSegmentAnnotations": [{"displayName": "swing", "startTime": "4.0s", "endTime": "9.0s"}], "dataItemResourceLabels": {"ml_use": "test"}}
...

CSV

열 목록
  1. 검증 데이터(선택사항). TRAINING, TEST 사양입니다.
  2. 분류하거나 주석을 달아야 할 내용. 이 필드에는 동영상의 Google Cloud Storage URI가 포함됩니다. Cloud Storage URI는 대소문자를 구분합니다.
  3. 동영상 분류 방법을 식별하는 라벨. 라벨은 문자로 시작해야 하며 문자, 숫자, 밑줄만 포함할 수 있습니다. CSV 파일에 각 행마다 다른 라벨을 사용하여 각각 동일한 동영상 세그먼트를 식별하는 여러 행을 추가하여 동영상에 여러 라벨을 지정할 수 있습니다.
  4. 동영상 세그먼트의 시작 및 종료 시간. 이 쉼표로 구분된 두 개의 필드는 분석할 동영상 세그먼트의 시작 및 종료 시간을 초 단위로 나타냅니다. 시작 시간은 종료 시간보다 짧아야 합니다. 두 값 모두 음수가 아니어야 하며 동영상의 시간 범위 내에 있어야 합니다. 예를 들어 0.09845,1.3600555에서 첫 번째 값(0.09845)은 시작 시간이고 두 번째 값(1.3600555)은 라벨을 지정하려는 동영상 세그먼트의 종료 시간입니다. 동영상의 전체 콘텐츠를 사용하려면 시작 시간 0과 동영상 전체 길이의 종료 시간 또는 'inf'를 지정합니다. 예를 들면 0,inf입니다.
  5. 주석. 주석은 프레임 타임스탬프 또는 시간 세그먼트가 있는 라벨입니다.

각 행은 다음 중 하나여야 합니다.

VIDEO_URI, TIME_SEGMENT_START, TIME_SEGMENT_END, LABEL, ANNOTATION_FRAME_TIMESTAMP
VIDEO_URI, , , LABEL, ANNOTATION_FRAME_TIMESTAMP
VIDEO_URI, TIME_SEGMENT_START, TIME_SEGMENT_END, LABEL, ANNOTATION_SEGMENT_START, ANNOTATION_SEGMENT_END
VIDEO_URI, , , LABEL, ANNOTATION_SEGMENT_START, ANNOTATION_SEGMENT_END

몇 가지 예시

서로 다른 시점에서 작업 두 개에 라벨을 지정합니다.

gs://folder/video1.avi,kick,12.90,,
gs://folder/video1.avi,catch,19.65,,

두 기간 내에 관심 작업이 없습니다. 참고: 마지막 행은 완전히 라벨이 지정된 세그먼트에는 작업이 포함되지 않음을 의미합니다.

gs://folder/video1.avi,,,10.0,20.0
gs://folder/video1.avi,,,25.0,40.0

학습 데이터에는 라벨이 최소 1개 이상, 전체 라벨이 지정된 세그먼트가 하나 있어야 합니다.


학습된 모델의 결과를 확인하기 위해 유효성 검사 데이터를 지정할 필요가 없습니다. Vertex AI는 학습용으로 식별된 행을 자동으로 학습 데이터와 검증 데이터로 나눕니다. 학습 데이터는 80%이고 검증 데이터는 20%입니다.

콘텐츠를 Cloud Storage 버킷에 CSV 파일로 저장합니다.