Buckets:
Video Processor
VideoProcessor cung cấp API thống nhất cho các pipeline video để chuẩn bị đầu vào cho mã hóa VAE và xử lý hậu kỳ đầu ra sau khi chúng được giải mã. Lớp này kế thừa VaeImageProcessor nên bao gồm các phép biến đổi như thay đổi kích thước, chuẩn hóa và chuyển đổi giữa mảng PIL Image, PyTorch và 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)
Tham số:
video (list[PIL.Image], list[list[PIL.Image]], torch.Tensor, np.array, list[torch.Tensor], list[np.array]) : Video đầu vào. Nó có thể là một trong các định dạng sau: * danh sách các ảnh PIL. * danh sách của danh sách các ảnh PIL. * tensor Torch 4 chiều (shape mong đợi cho mỗi tensor là (num_frames, num_channels, height, width)). * mảng NumPy 4 chiều (shape mong đợi cho mỗi mảng là (num_frames, height, width, num_channels)). * danh sách các tensor Torch 4 chiều (shape mong đợi cho mỗi tensor là (num_frames, num_channels, height, width)). * danh sách các mảng NumPy 4 chiều (shape mong đợi cho mỗi mảng là (num_frames, height, width, num_channels)). * mảng NumPy 5 chiều: shape mong đợi cho mỗi mảng là (batch_size, num_frames, height, width, num_channels). * tensor Torch 5 chiều: shape mong đợi cho mỗi mảng là (batch_size, num_frames, num_channels, height, width).
height (int, tuỳ chọn, mặc định là None) : Chiều cao tính bằng số khung hình đã tiền xử lý của video. Nếu là None, sẽ sử dụng get_default_height_width() để lấy chiều cao mặc định.
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.
Trả về: torch.Tensor có hình dạng (batch_size, num_channels, num_frames, height, width)
Một tensor 5D chứa các video dạng kênh-đầu tiên (channels-first) đã được nhóm (batched).
Tiền xử lý video đầu vào. Các đối số từ khóa sẽ được chuyển tiếp đến VaeImageProcessor.preprocess.
diffusers.VideoProcessor.postprocess_video[[diffusers.VideoProcessor.postprocess_video]]
diffusers.VideoProcessor.postprocess_video(video: Tensor, output_type: str = 'np', **kwargs)
Tham số:
video (torch.Tensor) : Video dưới dạng tensor.
output_type (str, mặc định là "np") : Kiểu đầu ra của tensor video sau khi xử lý hậu kỳ.
Chuyển đổi một tensor video thành danh sách các khung hình để xuất. Các đối số từ khóa sẽ được chuyển tiếp đến VaeImageProcessor.postprocess.
Xet Storage Details
- Size:
- 3.31 kB
- Xet hash:
- 73893ea92a2c7366a2f8302203444ad7b89758c9432350ff10096b62023ecefe
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.