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

Zhi Chen1,*, Runze Hu2,*, Le Zhang1,†
1 School of Engineering, University of Birmingham
2 School of Public Health, Peking University
Medical Image Segmentation · Research Project
Paper Code ↗ arXiv ▧ Poster
* Equal contribution   ·   † Corresponding author

Abstract

Flow matching offers a deterministic generative framework for medical image segmentation, but effective alignment between noisy intermediate states and clean image features remains challenging. We present MedFlowSeg, a conditional flow matching framework that learns a time-dependent vector field to transform a simple prior into a target segmentation. Its dual-conditioning design combines a Dual-Branch Spatial Attention (DB-SA) module for multi-frequency structural guidance with Frequency-Aware Attention (FA-Attention) for discrepancy-aware interactions across spatial and spectral representations. A time-conditioned Neural Modulator further adapts semantic features along the flow trajectory. Experiments across five medical image segmentation datasets show strong results across MRI, fundus, histology, and ultrasound modalities.

Motivation

Generative segmentation can represent complex anatomical variation, yet diffusion-based approaches often rely on many denoising iterations. Flow matching provides a continuous path from noise to a mask, but the evolving noisy state and the clean semantic features extracted from the image can be difficult to align.

Efficient generationLearn a continuous velocity field and follow it with an ODE solver.
Better conditional alignmentGuide the flow with spatial structure and time-aware semantic information.
MedFlowSeg conditional flow matching pipeline, from Gaussian noise to a segmentation mask
Overview of conditional flow matching. The image condition guides the Flow Network as an initial noise sample moves toward the target segmentation.

Method

MedFlowSeg uses two U-Net-style streams. The Condition Network extracts image features, while a time-conditioned Flow Network predicts the velocity of the current mask state. The two streams interact at complementary levels: DB-SA injects low- and high-frequency structural cues into shallow flow features, and FA-Attention aligns deep semantic features across spatial and frequency domains.

MedFlowSeg architecture showing its Condition Network, Flow Network, DB-SA, FA-Attention, and Neural Modulator
MedFlowSeg architecture: structural guidance is introduced through DB-SA, and semantic alignment is refined by FA-Attention and the time-conditioned Neural Modulator.
Dual-Branch Spatial Attention (DB-SA)Separates coarse anatomical structure from fine boundary details and injects both into the shallow flow representation.
Frequency-Aware Attention (FA-Attention)Combines global spectral interactions with spatial-token discrepancy modeling at the bottleneck.

Training jointly optimizes velocity supervision and an auxiliary segmentation objective on the condition branch.

Experiments

MedFlowSeg is evaluated on five public datasets spanning cardiac MRI, brain MRI, fundus images, histology, and echocardiography.

ACDC · Cardiac MRIBraTS-2021 · Brain MRIREFUGE-2 · FundusGlaS · HistologyCAMUS · Echocardiography
ACDC cardiac segmentation results (average over RV, myocardium, and LV)
MethodDice ↑IoU ↑HD95 ↓
EnsemDiff92.7686.616.25
MedSegDiff91.8985.127.16
MedSegDiff-V292.6886.396.03
FlowSDF91.4384.256.38
MedFlowSeg93.5787.735.27
Qualitative segmentation comparison across brain MRI, fundus, ultrasound, and histology
Qualitative comparison across imaging modalities. Rows show brain MRI, fundus, echocardiography, and histology; the final column shows MedFlowSeg predictions.

BibTeX

@misc{chen2026medflowsegflowmatchingmedical,
      title={MedFlowSeg: Flow Matching for Medical Image Segmentation with Frequency-Aware Attention}, 
      author={Zhi Chen and Runze Hu and Le Zhang},
      year={2026},
      eprint={2604.19675},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2604.19675}, 
}
View the complete research posterFull MedFlowSeg research poster