Diffusers documentation

Video Processor

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Video Processor

VideoProcessor는 VAE 인코딩을 위한 입력 준비와 디코딩 후 출력의 후처리를 수행하는 비디오 파이프라인을 위한 통합 API를 제공합니다. 이 클래스는 VaeImageProcessor를 상속하므로 리사이즈, 정규화, PIL Image, PyTorch, NumPy 배열 간의 변환과 같은 변환을 포함합니다.

VideoProcessor

diffusers.VideoProcessor.preprocess_video

< >

( videoheight: int | None = Nonewidth: int | None = None**kwargs ) → torch.Tensor of shape (batch_size, num_channels, num_frames, height, width)

매개변수

  • video (list[PIL.Image], list[list[PIL.Image]], torch.Tensor, np.array, list[torch.Tensor], list[np.array]) — 입력 비디오입니다. 다음 중 하나일 수 있습니다:
    • PIL 이미지 목록
    • PIL 이미지 목록의 목록
    • 4D Torch 텐서(각 텐서의 예상 shape는 (num_frames, num_channels, height, width)입니다).
    • 4D NumPy 배열 (각 배열의 예상 shape: (num_frames, height, width, num_channels)).
    • 4D Torch 텐서의 목록 (각 텐서의 예상 shape는 (num_frames, num_channels, height, width)입니다).
    • 4D NumPy 배열 목록 (각 배열의 예상 shape는 (num_frames, height, width, num_channels)입니다).
    • 5D NumPy 배열: 각 배열의 예상 shape (batch_size, num_frames, height, width, num_channels).
    • 5D Torch 텐서: 각 배열의 예상 shape는 (batch_size, num_frames, num_channels, height, width)입니다.
  • height (int, 선택 사항, 기본값 None) — 비디오의 전처리된 프레임 높이입니다. None인 경우 get_default_height_width()를 사용하여 기본 높이를 가져옵니다.
  • width (int, optional, defaults to None) -- The width in preprocessed frames of the video. If None, will use get_default_height_width() to get the default width.

반환값

torch.Tensor, shape (batch_size, num_channels, num_frames, height, width)

5D 텐서로, 배치된 채널 우선 비디오를 포함합니다.

입력 비디오를 전처리합니다. 키워드 인수는 VaeImageProcessor.preprocess로 전달됩니다.

diffusers.VideoProcessor.postprocess_video

< >

( video: Tensoroutput_type: str = 'np'**kwargs )

매개변수

  • video (torch.Tensor) — 텐서로 표현된 비디오.
  • output_type (str, 기본값 "np") — 전처리된 video 텐서의 출력 유형.

비디오 텐서를 내보내기용 프레임 목록으로 변환합니다. 키워드 인수는 VaeImageProcessor.postprocess로 전달됩니다.

Update on GitHub