Optical Flow Representation Alignment Mamba Diffusion Model for Medical Video Generation

Zhenbin Wang, Lei Zhang, Lituan Wang, Minjuan Zhu, Zhenwei ZhangarXiv 2024 · DOI

Abstract

Generating high-fidelity medical videos is critical for clinical training and simulation but remains computationally challenging due to the high anatomical precision and temporal coherence required. We present MedSora, a novel diffusion-based framework that leverages State Space Models (Mamba) and optical flow representation alignment. MedSora addresses the quadratic complexity of traditional attention-based models by employing a hybrid Mamba-attention backbone, achieving linear scaling with sequence length. Furthermore, it incorporates motion priors through optical flow alignment and preserves fine textures using a frequency-compensated VAE. Experimental results across three medical datasets demonstrate that MedSora outperforms existing state-of-the-art models in visual quality and temporal consistency while significantly reducing computational overhead.

Introduction

The generation of realistic medical footage, such as colonoscopies and laparoscopic surgeries, is a complex task for generative AI. Unlike natural video domains, medical applications demand extreme anatomical accuracy; visual artifacts or "hallucinations" can compromise the utility of the generated data for clinical simulation. Current state-of-the-art video diffusion models primarily rely on spatio-temporal self-attention. While effective, this mechanism exhibits quadratic complexity ($O(N^2)$) relative to video length and resolution, leading to prohibitive computational costs. Moreover, these models often struggle to capture the non-linear, complex motion of internal organs and surgical instruments. MedSora aims to bridge this gap by providing a computationally efficient and physically realistic generative model.

Methods

MedSora introduces three primary architectural innovations to enhance efficiency and realism:

1. Hybrid Mamba-Attention Backbone

To balance fine-grained spatial detail with long-range temporal dependencies, MedSora utilizes a hybrid architecture. It employs Local Attention for spatial feature extraction and Spatio-temporal Mamba for modeling long-range sequences. Unlike Transformers, Mamba scales linearly ($O(N)$) with sequence length, allowing for efficient processing of high-resolution video data.

Comparison of traditional attention/convolution mechanisms versus the proposed Spatio-temporal Mamba with selective scanning.

2. Optical Flow Representation Alignment

To ensure smooth and physically plausible motion, MedSora incorporates motion priors. The framework uses a pre-trained RAFT model to extract optical flow from real medical videos and a self-supervised DINO model to transform this flow into high-level feature representations. During training, the diffusion model’s internal features are aligned with these motion priors, effectively teaching the model the underlying "physics" of medical organ deformation and tool movement.

3. Frequency Compensation Video VAE

Standard Variational Autoencoders (VAEs) often lose high-frequency details, resulting in blurred textures. MedSora utilizes a 3D causal VAE enhanced with Focal Frequency Loss. This ensures that critical clinical details—such as the specific texture of a lesion or the sharp edges of surgical tools—are preserved during the compression and reconstruction phases.

Experimental Results

The model was evaluated on three specialized medical video datasets: Colonoscopic (210 videos), CholecTriplet (50 laparoscopic surgery videos), and Kvasir-Capsule (117 capsule endoscopy videos). Training was conducted on 16-frame clips at a resolution of 128x128.

Quantitative Performance

MedSora achieved state-of-the-art results across all benchmarks, outperforming baselines such as StyleGAN-V, LVDM, and Endora. On the Colonoscopic dataset, MedSora reached a Fréchet Video Distance (FVD) of 429.35, significantly better than the previous best diffusion model, Endora (468.37). It also demonstrated superior Fréchet Inception Distance (FID) and Frame Consistency (FC), indicating smoother transitions and higher image quality.

Computational Efficiency

The base version, MedSora-B, requires substantially less GPU memory and floating-point operations (FLOPs) compared to attention-heavy models like Endora. This efficiency makes high-quality medical video generation more accessible to institutions with limited computational resources.

Downstream Utility

A key finding was the model's potential as a data augmentor. In semi-supervised learning tests, augmenting training sets with MedSora-generated videos improved the F1-score of a disease classifier by over 13% on the Colonoscopic dataset, highlighting its value in addressing data scarcity for rare medical conditions.

Conclusion

MedSora represents a significant step forward in medical video synthesis, combining the efficiency of State Space Models with robust motion alignment. While current experiments are limited to 128x128 resolution, future work will focus on scaling to high-definition outputs and exploring text-to-video capabilities for customized surgical scenario generation.

Summary updated

BibTeX
@misc{wang2024optical,
  author = {Zhenbin Wang and Lei Zhang and Lituan Wang and Minjuan Zhu and Zhenwei Zhang},
  title = {{Optical Flow Representation Alignment Mamba Diffusion Model for Medical Video Generation}},
  year = {2024},
  eprint = {2411.01647},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.01647},
}
Figure