UIUC's FMS² Fixes Broken AI Vessel Segmentation With Flow-Matching ODEs
A new flow-matching framework turns segmentation into continuous image-to-mask transport, cutting topology errors 37% while slashing label requirements by 75%.
ProTakeaways
- FMS² recasts thin-structure segmentation as continuous image-to-mask transport via flow matching.
- SegFlow is a 2.96M-parameter U-Net that supervises the entire ODE trajectory, not end-state logits.
- Mean IoU rises from 0.511 to 0.599 and Betti matching error drops 37.3% across five benchmarks.
- SynFlow renders pixel-aligned mask-to-image pairs using multi-scale mask injection and edge-aware gating.
- With only 25% real labels plus synthetic pairs, SegFlow nearly matches fully-supervised performance.
- Cross-domain IoU improves by 0.11 on average, vastly outperforming classical augmentation on crack transfer.
Segmenting the wiry stuff in images, hairline cracks in concrete, capillaries in a retinal scan, coronary arteries in an X-ray, is one of those problems where standard segmentation networks quietly fall apart. The targets are one pixel wide, they branch unpredictably, and a single broken centerline can invalidate a downstream measurement. A group from the University of Illinois at Urbana-Champaign has proposed a rethink called FMS² that treats segmentation as a flow-matching transport problem and pairs it with a mask-conditioned image generator to fix the perennial label-scarcity issue.
Why thin structures break normal segmenters
Segmenting thin structures like infrastructure cracks and anatomical vessels is a task hampered by topology-sensitive geometry, high annotation costs, and poor generalization across domains. The classical response has been to bolt on topology-aware losses like clDice or Skeleton Recall, which reward centerline overlap on top of standard Dice or cross-entropy. Standard deep learning segmentation losses focus on volumetric overlap, often at the expense of preserving structural connectivity, which can lead to errors that hurt downstream tasks like flow calculation, navigation, and structural inspection. Current topology-focused losses mark an improvement, but they introduce significant computational and memory overheads.
Even with those fixes, the supervision only touches the final predicted mask. If a branch has already been dropped by the time logits are computed, the loss can only complain, not repair. FMS² argues the answer is to supervise the entire formation process of the mask.

SegFlow: segmentation as an ODE
The first module, SegFlow, is a compact 2.96M-parameter U-Net that replaces per-pixel classification with continuous transport. Instead of predicting logits, it learns a time-indexed velocity field that carries an input image toward its ground-truth mask along a straight-line path. Training regresses the velocity to the constant target x_1 - x_0 at random points on that path, and inference is just Euler integration from image to mask with a handful of steps.
The practical consequence is that connectivity is enforced across the whole trajectory, not just at the endpoint. When a thin branch is about to disconnect at some intermediate time, the velocity field has to actively repair it to land on the true mask. For the trickiest cases, the authors also introduce a self-conditioning variant that feeds a running estimate of the terminal mask back into the network, which stabilizes ultra-sparse cracks with minimal added complexity.
SynFlow: paired synthetic data that keeps the topology
The second module, SynFlow, runs the flow the other way. Given a binary mask, it renders a photorealistic image that stays pixel-aligned with that mask. Two architectural additions do the heavy lifting:
- Lite-SPADE GroupNorm (LSGN): a small conv head turns downsampled masks into affine parameters that modulate group-normalized features at every scale, so structural geometry survives pooling and upsampling.
- Boundary-Gating Module (BGM): a soft edge band derived from morphological dilate/erode operations gates decoder features, forcing capacity onto the narrow region where topological errors actually happen.
A controllable mask generator then feeds SynFlow masks binned by sparsity, width, and branching, which lets synthetic supervision target the regimes where real annotations are rarest.

The numbers
Evaluated on five benchmarks (CRACK500, CrackTree260, CrackLS315, DRIVE retinal fundus, XCAD coronary angiography), SegFlow alone outperforms strong CNN, Transformer, Mamba, and generative baselines, improving the volumetric metric (mean IoU) from 0.511 to 0.599 (+17.2%) and reducing the topological metric (Betti matching error) from 82.145 to 51.524 (-37.3%). The comparison covers Mask2Former, DConnNet, SemFlow, FlowSDF, Topograph, and SCSegamba, so it is not a soft field.
Trained head-to-head on the same U-Net backbone, flow-matching supervision also beats topology-aware end-state losses: clCE brings the mean Betti error to 71.3 and Skeleton Recall to 73.7, while SegFlow reaches 51.5. Where SynFlow really pays off is under label scarcity and domain shift:
- Augmenting SegFlow with SynFlow-generated pairs recovers near-full performance using 25% of real annotations and improves cross-domain IoU by 0.11 on average.
- On CrackLS315 to CRACK500 transfer, SynFlow lifts mIoU by 84.3% relative over the SegFlow baseline, while classic augmentation (flips, rotations, jitter) manages only about 2.7%.
What it is good and bad at
The framework is a good fit when your labels are pixel-accurate but scarce, and when a broken centerline would spoil the downstream metric, whether that is a vessel diameter, a crack length, or a road graph. It is less obviously useful for chunky semantic regions where a standard segmenter already does fine. There is also a residual gap on high-variability domains like coronary angiography, where appearance shifts still outpace what SynFlow can synthesize.
The authors say the code and a new large-scale dataset of thin-structure image-mask pairs (10k cracks, 1k vessels) will be released after acceptance, which would give practitioners a benchmark that is one to two orders of magnitude larger than the few-hundred-image sets most crack work still relies on. If you have been fighting fragmented masks with an ever-growing pile of topology losses, treating segmentation as an ODE is a genuinely different lever to pull.