Buckets:
Video Processor
VideoProcessor menyediakan API terpadu untuk pipeline video guna menyiapkan input untuk encoding VAE dan memproses output pasca-dekode. 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]]
diffusers.VideoProcessor.preprocess_video[[diffusers.VideoProcessor.preprocess_video]]
diffusers.VideoProcessor.preprocess_video(video, height: int | None = None, width: int | None = None, **kwargs)
Parameter:
video (list[PIL.Image], list[list[PIL.Image]], torch.Tensor, np.array, list[torch.Tensor], list[np.array]) : Video input. Dapat berupa salah satu dari berikut: * 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, defaultnya 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[[diffusers.VideoProcessor.postprocess_video]]
diffusers.VideoProcessor.postprocess_video(video: Tensor, output_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.
Xet Storage Details
- Size:
- 2.97 kB
- Xet hash:
- b36e4c0499190b901da16974cce14d5e6f2f2e4ba420f255ed678854b0b01e49
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.