My implementation of "Dual-Stream Diffusion Net "
The DSDN consists of the following main components:
-
Encoder (E): Encodes input video frames x into latent space as z0 = E(x). Uses a pre-trained VQ-VAE encoder which is frozen during training.
-
Motion Decomposer: Decomposes z0 into content features z0 and motion features z~0. Uses a lightweight architecture with 1x1 convolutions and channel reduction.
-
Forward Diffusion: Applies separate forward diffusion processes on z0 and z
0 to obtain priors zT and zT. Uses the same noise schedule for both. -
Personalized Content Generation Stream: Denoises zT to get z0|T. Uses a content base unit (pre-trained text-to-image model) and content increment unit.
-
Personalized Motion Generation Stream: Denoises z
T to get z0|T. Uses a 3D UNet architecture. -
Dual-Stream Interaction: Aligns the generated z0|T and z~0|T using cross-attention transformers.
-
Motion Combiner: Compensates motion information into content features to obtain final video latent code z^0. Inverse of motion decomposer.
-
Decoder (D): Decodes z^0 to generate video frames x.
-
Content Base Unit: Pre-trained text-to-image model (Stable Diffusion) that remains frozen during training.
-
Content Increment Unit: Small tunable network to refine content generation. Uses low-rank decomposition for efficiency.
-
Personalized Motion Generation Stream: 3D UNet diffusion model to generate coherent motion latent features.
-
Dual-Stream Interaction: Cross-attention modules between content and motion streams for alignment.
-
Encode input video x into z0 using VQ-VAE E
-
Decompose z0 into content z0 and motion z~0 features
-
Perform forward diffusion on z0 and z
0 to get priors zT, zT -
Denoise zT in content stream to get z0|T
- Use content base unit (frozen)
- Refine with trainable content increment unit
-
Denoise z
T in motion stream to get z0|T- Use 3D UNet architecture
-
Align z0|T and z~0|T using dual-stream interaction
- Apply cross-attention transformers between streams
-
Combine aligned z0|T and z~0|T to get final latent code z^0
-
Decode z^0 to generate video frames x using decoder D
This analysis covers the key components and algorithm for implementing the DSDN model in PyTorch. The dual-stream architecture with separate content and motion diffusion along with the interaction module are critical for generating smooth and consistent videos from text descriptions.