University of Illinois Urbana-Champaign Block I logo University of Illinois Urbana-Champaign

FMS2: Unified Flow Matchingfor Segmentation and Synthesis of Thin Structures

Babak Asadi, Peiyang Wu, Mani Golparvar-Fard, Viraj Shah, Ramez Hajj

University of Illinois at Urbana-Champaign

Paper Supplementary Code Checkpoints Benchmark Data Released Dataset Coming Soon
FMS2 overview with examples, predicted masks, and metric radar plot.
FMS2 combines image-to-mask transport for segmentation with mask-to-image transport for label-efficient synthesis.

Abstract

FMS2 is a unified flow-matching framework for thin structures such as infrastructure cracks and anatomical vessels, where one-pixel topology, high annotation cost, and domain shift make segmentation brittle. SegFlow is a 2.96M-parameter encoder-decoder that recasts segmentation as continuous image→mask transport: it learns a time-indexed velocity field and supervises the full mask-formation trajectory instead of only endpoint logits. SynFlow performs the complementary mask→image transport, using multi-scale mask injection, lite-SPADE GroupNorm, and boundary gating to preserve mask geometry while rendering realistic image-mask pairs. A controllable mask generator expands sparsity, width, and branching, enabling label-efficient and domain-robust training.

Method

SegFlow and SynFlow are coupled by trajectory supervision.

Architecture and transport view of SegFlow, SynFlow, LSGN, and BGM.
Architecture and transport view. SegFlow evolves image to mask; SynFlow renders mask-conditioned images with topology-aware mask injection.

Shared Pathwise Objective

\[ x_t=(1-t)x_0+t x_1,\quad u_t^{\mathrm{target}}=x_1-x_0 \]

Both branches learn velocities over intermediate states. The loss supervises the transport trajectory, rather than only the final prediction.

SegFlow Loss

\[ \mathcal{L}_{\mathrm{SegFlow}} = \mathbb{E}\left[\left\|u_{\theta}(x_t,t) - (x_1-x_0)\right\|_2^2\right] \]

SegFlow transports the observed image into the binary mask, forcing thin branches to remain recoverable throughout ODE integration.

SynFlow Loss

\[ \mathcal{L}_{\mathrm{SynFlow}} = \mathbb{E}\left[\left\|\mathbf{u}_{\theta}(\mathbf{x}_t,t\mid\mathbf{M})-\partial_t\mathbf{x}_t\right\|_2^2\right] \]

SynFlow reverses the direction: masks condition image synthesis, producing paired data that preserves geometry and pixel-level alignment.

Selected Results

Overlap improves, topology breaks less often.

Mean IoU 0.599

+17.2% over the strongest prior mean IoU.

Mean clDice 0.774

Sharper and more connected thin structures.

Betti Error 51.524

37.3% lower mean topological mismatch.

Our Released Dataset 11k

10k crack and 1k vessel image-mask pairs released by FMS2.

SOTA Comparison Across Five Benchmarks

Method Venue Mean mIoU ↑ Mean F1 ↑ Mean clDice ↑ Mean μerr ↓
Mask2FormerCVPR 20220.4520.6100.674107.423
DConnNetCVPR 20230.4820.6350.69390.895
SemFlowNeurIPS 20240.1420.2350.225186.707
FlowSDFIJCV 20250.5110.6580.68195.995
TopographICLR 20250.3720.5070.510149.121
SCSegambaCVPR 20250.5080.6650.69782.145
SegFlowOurs0.5990.7390.77451.524

Same Architecture, Different Supervision

Same U-Net backbone and training protocol; only the loss changes.

Loss / Supervision Mean μerr ↓
clCE71.348
Skeleton Recall73.738
SegFlow FM objective51.524

Cross-Domain Crack Transfer

Method C500→Tree LS315→C500 Tree→C500
SegFlow0.251/0.3960.223/0.3520.254/0.393
SegFlow+DA0.259/0.4080.229/0.3580.257/0.395
SegFlow+SynFlow0.305/0.4440.411/0.5660.340/0.489

Label Efficiency

SynFlow cuts real annotations by 75% while approaching full supervision.

With only \(0.25R\) real labels, adding SynFlow-generated image-mask pairs steadily closes the gap to the full real set \(R\), improving both mIoU and clDice across crack and vessel benchmarks.

Label efficiency plot showing SynFlow-generated samples closing the gap to full supervision.

Benchmark Datasets Used For Evaluation

Dataset Structure Type Download
Crack500Infrastructure cracksDownload
CrackTree260Infrastructure cracksDownload
CrackLS315Infrastructure cracksDownload
XCADCoronary angiography vesselsDownload
DRIVERetinal vesselsDownload

Pretrained Checkpoints

Citation

@article{asadi2026fms,
  title={FMS$^2$: Unified Flow Matching for Segmentation and Synthesis of Thin Structures},
  author={Asadi, Babak and Wu, Peiyang and Golparvar-Fard, Mani and Shah, Viraj and Hajj, Ramez},
  journal={arXiv preprint arXiv:2603.13659},
  year={2026}
}