Diffusers documentation

Video Processor

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画像のリストのリスト。
    • 4次元の Torch テンソル(各テンソルの想定される形状は (num_frames, num_channels, height, width) です)。
    • 4次元NumPy配列(各配列の想定される形状は(num_frames, height, width, num_channels)です)。
    • 4次元 Torch テンソルのリスト(各テンソルの想定形状は(num_frames, num_channels, height, width))。
    • 4次元NumPy配列のリスト(各配列の想定形状は(num_frames, height, width, num_channels))。
    • 5次元NumPy配列: 各配列の期待される形状は(batch_size, num_frames, height, width, num_channels)です。
    • 5次元の Torch テンソル: 各配列の期待される形状は (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、形状 (batch_size, num_channels, num_frames, height, width)

バッチ化されたチャネル優先の動画を含む5次元テンソル。

入力動画の前処理を行います。キーワード引数は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