NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MedFlowSeg: Flow Matching for Medical Image Segmentation with Frequency-Aware Attention

Zhi Chen, Runze Hu, Le ZhangNeurIPS 2026

TL;DR

Generative models are transforming medical image segmentation because they can model anatomical ambiguity rather than forcing a single, overconfident guess. However, standard diffusion models are computationally sluggish and struggle to align noisy intermediate guesses with clean medical images. MedFlowSeg replaces stochastic diffusion with deterministic flow matching and introduces a clever dual-conditioning attention system—delivering state-of-the-art segmentation accuracy across five imaging modalities at a fraction of the computational cost.

What Problem Does This Paper Address?

Medical scans are notoriously messy—blurry boundaries, scanner noise, and weird pathology mean a single deterministic prediction (like a standard U-Net) often misses the mark. Generative models—specifically diffusion models—solve this by generating an ensemble of plausible segmentations from random noise, naturally capturing structural uncertainty.

The catch? Diffusion models rely on reversing a stochastic noise process over many rigid, iterative steps, making inference slow and computationally heavy. Recently, flow matching has emerged as a faster alternative that learns a straight, deterministic path (via an Ordinary Differential Equation, or ODE) from noise to target. Yet, both diffusion and early flow-matching models share a fundamental blind spot: feature mismatch. To guide the generation, you have to inject features from the clean raw scan into the generative network. Simply mashing clean, static image features together with noisy, time-evolving flow states confuses the network, hurting boundary sharpness and cross-modality generalization.

Methods

MedFlowSeg sets up a two-stream architecture using two parallel UNet-style backbones: a Flow Network (processing the evolving noisy mask $x_t$ at time $t$) and a Condition Network (extracting priors from the raw medical scan $I$).

Figure 1: Overview of the proposed MedFlowSeg pipeline. The generative process is defined as a continuous trajectory from a random noise prior x0 to the final segmentation label x1. At a given time step t, the intermediate state xt is generated. The raw medical image I is processed by a Condition Network to provide structural and semantic guidance to the Flow Network. The model takes xt, I, and t as inputs to predict the image-guided velocity ˆut. During training, the model is optimized by minimizing the velocity loss between ˆut and the target velocity ut = x1 −x0, together with an auxiliary segmentation loss applied on the condition branch.

While standard conditional flow matching uses an $L_2$ loss, MedFlowSeg trains its velocity field using an $L_1$ loss to better preserve sharp anatomical boundaries, paired with an auxiliary segmentation loss (Dice + Cross-Entropy) on the Condition Network's output.

What is genuinely novel here is how the two networks talk to each other—a dual-conditioning setup designed explicitly to bridge the noisy-to-clean gap:

Figure 2: An illustration of MedFlowSeg, which starts from (a) an overview of the two-stream architecture, and continues with zoomed-in diagrams of individual modules, including (b) FA- Attention, and (c) Neural Modulator.
  • Structural Guidance via Dual-Branch Spatial Attention (DB-SA): Instead of passing shallow encoder features, DB-SA grabs the final high-resolution decoder feature from the Condition Network. It splits this clean representation using learnable Gaussian filters into low-frequency cues (coarse organ layouts) and high-frequency cues (crisp edges), injecting them as an attention map into the very first stage of the Flow Network.
  • Semantic Alignment via Frequency-Aware Attention (FA-Attention): Placed at the deep bottleneck, this module aligns global semantics without letting noisy local artifacts ruin the party. It splits features into two pathways:
  • A spectral branch that uses Fast Fourier Transforms (FFT) and cross-attention to align global, long-range anatomical structures in the frequency domain.
  • A spatial-token branch featuring a Token Discrepancy Extractor (TD-X) that explicitly calculates the mathematical agreement ($T_f \odot T_c$), absolute difference ($|T_f - T_c|$), and directional residual ($T_f - T_c$) between the noisy flow tokens and clean condition tokens.
  • Finally, a time-conditioned Neural Modulator fuses both branches to dynamically recalibrate the features before converting them back via Inverse FFT.

Datasets

No new datasets are introduced; the authors evaluate generalization across five existing public benchmarks spanning diverse modalities (all resized to $256 \times 256$):

  • ACDC: Cardiac cine-MRI (multi-class: RV, Myo, LV).
  • BraTS-2021: Brain tumor MRI.
  • REFUGE-2: Optic disc and cup in color fundus photography.
  • GlaS: Gland segmentation in RGB histology slides.
  • CAMUS: Cardiac ultrasound (echocardiography).

Key Insights and Ideas

  • It’s how you condition, not just how big you build: Complex transformers (like Swin-UNet) and early diffusion models don't consistently beat a well-tuned CNN like nnUNet. Generative segmentation lives or dies by how cleanly you bridge the gap between static image priors and noisy intermediate states.
  • Explicitly modeling "disagreement" works: Rather than hoping cross-attention figures out the difference between a half-formed noisy mask and a clean MRI feature, explicitly computing their element-wise product, difference, and residual (via TD-X) gives the network a massive head start.
  • Complementary division of labor: Uncertainty ablations reveal a neat synergy—DB-SA primarily drives prediction stability (lowering variance across runs), while FA-Attention drives distribution alignment (ensuring diverse samples match ground-truth reality).

Key Results

Using 50 ODE sampling steps and averaging 10 ensemble runs (fused via STAPLE), MedFlowSeg consistently outperforms CNN, Transformer, diffusion, and flow baselines:

  • Multi-class Cardiac MRI (ACDC): Achieves 93.57% Dice, 87.73% IoU, and 5.27 HD95, beating strong diffusion baselines like MedSegDiff-V2 (92.68% Dice) and flow-based FlowSDF (91.43% Dice).
  • Cross-Modality Dominance: Hits state-of-the-art Dice scores on BraTS-2021 (91.2%), GlaS (92.8%), and REFUGE2-Cup (88.6%), outperforming even specialized, task-specific architectures on their home turf.
Figure 4: Visual comparison of our method against the representative baselines presented in Table 2. The rows, from top to bottom, display brain tumor segmentation, optic disc segmentation, optic cup segmentation, gland segmentation and echocardiographic segmentation, respectively.
  • Compute Efficiency & Stability: Despite having 111M parameters, MedFlowSeg converges much faster, requiring only 789 GFLOPs per image—far leaner than MedSegDiff-V2 (983 GFLOPs) and FlowSDF (1997 GFLOPs), while achieving the lowest prediction variance (5.6 SD) and Generalized Energy Distance (21.9 GED). It also degrades gracefully when input resolutions are severely downsampled.

Limitations and Future Work

The authors do not include a dedicated limitations section, and future work is only broadly framed around using MedFlowSeg as a scalable foundation for generative medical image analysis. However, a few practical constraints are apparent from their methodology:

  • 2D Slice-by-Slice Processing: Even for 3D volumetric scans (like ACDC and BraTS), the model operates on uniform $256 \times 256$ 2D slices and reconstructs the 3D volume afterward, potentially missing native 3D inter-slice context.
  • Ensemble Overhead: While 50 ODE steps is half of what competing generative models need, inference still requires running the model 10 separate times per image and fusing the outputs with STAPLE—meaning real-time clinical deployment remains much heavier than a single-pass deterministic U-Net.

Summary updated

BibTeX
@inproceedings{chen2026medflowseg,
  author = {Zhi Chen and Runze Hu and Le Zhang},
  title = {{MedFlowSeg: Flow Matching for Medical Image Segmentation with Frequency-Aware Attention}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=bf3XH3GbLU},
}
Figure