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 menyediakan API terpadu untuk pipeline video guna menyiapkan input untuk encoding VAE dan memproses output setelah didekode. Kelas ini mewarisi VaeImageProcessor sehingga mencakup transformasi seperti pengubahan ukuran, normalisasi, dan konversi antara PIL Image, PyTorch, dan array 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)

Parameter

  • video (list[PIL.Image], list[list[PIL.Image]], torch.Tensor, np.array, list[torch.Tensor], list[np.array]) — Video input. Bisa berupa salah satu dari berikut ini:
    • daftar gambar PIL.
    • daftar dari daftar gambar PIL.
    • Tensor Torch 4D (bentuk yang diharapkan untuk setiap tensor (num_frames, num_channels, height, width)).
    • Array NumPy 4D (bentuk yang diharapkan untuk setiap array (num_frames, height, width, num_channels)).
    • daftar tensor Torch 4D (bentuk yang diharapkan untuk setiap tensor (num_frames, num_channels, height, width)).
    • daftar array NumPy 4D (bentuk yang diharapkan untuk setiap array (num_frames, height, width, num_channels)).
    • Array NumPy 5D: bentuk yang diharapkan untuk setiap array (batch_size, num_frames, height, width, num_channels).
    • Tensor Torch 5D: bentuk yang diharapkan untuk setiap array (batch_size, num_frames, num_channels, height, width).
  • height (int, opsional, default None) — Tinggi dalam frame video yang telah dipreprocess. Jika None, akan menggunakan get_default_height_width() untuk mendapatkan tinggi default.
  • 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.

Mengembalikan

torch.Tensor dengan bentuk (batch_size, num_channels, num_frames, height, width)

Tensor 5D yang menyimpan video dengan format channel-first dalam batch.

Memproses prapemrosesan video input. Argumen kata kunci akan diteruskan ke VaeImageProcessor.preprocess.

diffusers.VideoProcessor.postprocess_video

< >

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

Parameter

  • video (torch.Tensor) — Video sebagai tensor.
  • output_type (str, defaultnya "np") — Tipe output dari tensor video yang telah diproses pascaproses.

Mengonversi tensor video menjadi daftar frame untuk diekspor. Argumen kata kunci akan diteruskan ke VaeImageProcessor.postprocess.

Update on GitHub