Diffusers documentation
Video Processor
시작하기
추론
확산 파이프라인 사용
어댑터 및 개인화
최적화 및 확장
모듈형 Diffusers
학습 및 파인튜닝
리소스
기여하기
API
주요 클래스
모듈형
로더
모델
Pipelines
스케줄러
내부 클래스
Video Processor
VideoProcessor는 VAE 인코딩을 위한 입력 준비와 디코딩 후 출력의 후처리를 수행하는 비디오 파이프라인을 위한 통합 API를 제공합니다. 이 클래스는 VaeImageProcessor를 상속하므로 리사이즈, 정규화, PIL Image, PyTorch, NumPy 배열 간의 변환과 같은 변환을 포함합니다.
VideoProcessor
diffusers.VideoProcessor.preprocess_video
< source >( 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 toNone) -- The width in preprocessed frames of the video. IfNone, 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
< source >( video: Tensoroutput_type: str = 'np'**kwargs )
비디오 텐서를 내보내기용 프레임 목록으로 변환합니다. 키워드 인수는 VaeImageProcessor.postprocess로 전달됩니다.