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画像のリストのリスト。
- 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 toNone) -- The width in preprocessed frames of the video. IfNone, 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
< source >( video: Tensoroutput_type: str = 'np'**kwargs )
動画テンソルをエクスポート用のフレームのリストに変換します。キーワード引数はVaeImageProcessor.postprocessに転送されます。