When a polyp blends into the surrounding mucosa, or a pancreatic tumor fades into healthy tissue, a segmentation network has no sharp intensity edge to follow. Most networks then output a blurry probability band and threshold it at 0.5. That threshold carries no notion of where a plausible contour could actually run. We propose to separate two questions that current models answer together. The first is how confident the model is about each pixel. A fast, trainable linear form of belief propagation answers this; belief propagation is message passing over a pixel graph that spreads evidence from confident pixels to their neighbors. The second is which closed contours the image actually supports. A Gomory-Hu tree answers this: it is one weighted tree that stores the minimum cut between every pair of nodes in a graph. Each edge of the tree corresponds to a weakest closed boundary in the image's affinity graph, and the tree's edges taken together give a nested family of candidate boundaries.
The final mask is the candidate contour, taken from that family, that maximizes expected Dice under the linear beliefs. The cut tree also yields a second output: an ambiguity map. It is low where one contour clearly dominates and high where several near-equal contours compete, which is exactly the "flat cut landscape" that defines low-contrast ambiguity. Two things in this design are new. Linearized belief propagation has never been used as a differentiable segmentation head on pixel graphs. All-pairs cut structure has never been used as the decision space for medical boundaries.
Core Claim
At a low-contrast boundary, the failure is usually not that the model's soft probabilities are useless. The failure is that the rule turning them into a mask ignores where the image can support a contour. We claim three things. First, a closed-form linear propagation head can be trained end to end and gives better-calibrated boundary beliefs than a network's softmax. Second, the nested minimum-capacity contours read off a Gomory-Hu tree of the learned affinity graph form a better candidate set than the two obvious nested families: probability level sets and parametric graph cuts. Third, the gap between competing cut values predicts where boundary errors occur. If the second claim fails, the all-pairs component should be dropped. The experiments are designed to test exactly that.
Building Blocks and How We Differ
The propagation layer reuses linearized belief propagation. The Linearization of Belief Propagation on Pairwise Markov Random Fields centers beliefs around a neutral value. It expands the multiplicative updates for moderate coupling and obtains a linear update with an explicit echo-cancellation term, plus a spectral bound on the coupling that guarantees convergence. Linearized and Single-Pass Belief Propagation gives the closed form and exact convergence criteria, and reports more than 99.9% agreement with standard belief propagation. For binary labels, with centered priors $\hat{x}$ (here, the network's logits shifted to zero mean), learned symmetric affinities $W$, degree matrix $D$, and scalar coupling $\epsilon$, the centered beliefs $\hat{b}$ solve
$$\hat{b} = \left(I - \epsilon W + \epsilon^2 D\right)^{-1} \hat{x}.$$
This is a sparse linear solve. Its gradient follows from the implicit function theorem, so it trains without the surrogate tricks that combinatorial heads need. Both LinBP papers work on social and bibliographic graphs and assume the coupling matrix is known; they list learning it as open. On pixel graphs, the coupling reduces to a scalar and the affinities come from deep features. We learn both from segmentation loss, keeping $\epsilon$ below the spectral bound by reparameterizing it through a sigmoid scaled by a power-iteration estimate of the spectral radius. The papers report that accuracy degrades under strong coupling. That warning constrains our design: we keep strong coupling in the affinities $W$ rather than in $\epsilon$.
The decision layer uses cut-equivalent trees. Cut-Equivalent Trees are Optimal for Min-Cut Queries shows that the Gomory-Hu tree is the optimal structure for answering min-cut queries. It is therefore the natural object when we need the cut values from many band pixels to each core region at once, rather than one source-sink cut. The complexity results in Breaking the Cubic Barrier for All-Pairs Max-Flow and the sieving algorithm in Approximate Gomory-Hu tree is faster than n - 1 max-flows tell us that whole-image cut trees are not out of reach asymptotically. The research file notes that these algorithms have no practical implementations. We therefore use the classical Gusfield construction (n−1 max-flows) on a reduced graph and treat the near-quadratic algorithms as a scaling path, not a dependency.
The construction works as follows. Pixels with confident beliefs are contracted into one foreground core node and one background core node. The remaining uncertain band is over-segmented into roughly one to three thousand superpixels. We then build the tree on this band graph. In the tree, for any band node $u$, $\lambda(u,F)$ and $\lambda(u,B)$ are the minimum cut values separating $u$ from the foreground and background cores. Every tree edge on the path between the cores is a closed candidate contour, and these contours are nested. We define the cut gap as
$$g(u) = \frac{\lambda(u,F) - \lambda(u,B)}{\lambda(u,F) + \lambda(u,B)}.$$
It is near zero when the image offers no cheaper contour on either side of $u$.
The decision rule follows Revisiting uncertainty in graph cut solutions. That paper turns graph-cut min-marginals into calibrated probabilities and shows that an expected-IoU decision rule raises multi-label IoU on PASCAL VOC from 17.7 to 20.0, at 0.16 seconds per call versus 59 seconds for loopy belief propagation. It motivates our decision rule, and we depart from it in two ways. Its marginals come from single source-sink dynamic cuts, whereas ours come from a closed-form linear solve. And it chooses among all masks, whereas we choose among contours the cut tree certifies. gcDLSeg is the closest system on the application side. It puts a binary source-sink cut on a U-Net, with deep cosine affinities, and trains it through a capacity-regression loss. It reaches 55.08% Dice on MSD Pancreas versus 52.00% for nnU-Net 3D, but it outputs one hard mask with no uncertainty, and its authors flag solver cost as a bottleneck. We keep its affinity design and move the combinatorial step out of the training loop. Belief Propagation for Min-Cost Network Flow connects message passing and flows only for nonlinear min-sum belief propagation and single-commodity flow, so it supplies intuition but no method here.
Research Program
We first build the head on top of an existing polyp backbone. Following the reverse-attention idea in PraNet, we use the confident regions as the propagation seeds. The head predicts unaries and affinities, solves the linear system with conjugate gradients on the GPU, and is trained with Dice plus binary cross-entropy on the beliefs.
At inference we extract the band, build the Gusfield tree on the band superpixel graph, and enumerate the nested contours on the core-to-core path. Each contour is scored by expected Dice under the beliefs, which is computable from the summed beliefs inside and outside the contour. We output the best contour together with the gap map.
The analysis has three parts. The first asks whether the gap map tracks boundary error better than belief entropy does. The second measures how often the chosen contour differs from the 0.5 threshold, and where. The third measures runtime as band size grows. In that runtime study we compare exact Gusfield against the approximate sieving construction of Approximate Gomory-Hu tree is faster than n - 1 max-flows, which tests whether its $(1+\epsilon)$ approximation preserves contour choice.
Baselines
The naive reference is the backbone's own softmax thresholded at 0.5, with no head. For polyps, the strongest existing method in the file is Polyp-PVT. It reports mean Dice of 0.787 on ETIS and 0.808 on ColonDB. PraNet reports 0.628 on ETIS and 0.898 on Kvasir, and MISNet reports 0.903 on Kvasir and 0.918 on ClinicDB. We attach our head to Polyp-PVT and to PraNet backbones, retrain each under the standard protocol (train on Kvasir and ClinicDB, test on ColonDB, ETIS and CVC-300) with identical epochs and augmentation, and also rerun the unmodified backbones ourselves. Beating Polyp-PVT means a statistically significant gain in Dice inside the boundary band on ETIS and ColonDB over our own rerun, measured across seeds, with whole-image Dice no worse. We read the published 0.787 only as a sanity anchor for the rerun.
For pancreas, the strongest competitor is gcDLSeg at 55.08% Dice on MSD Pancreas. We reimplement it on the same backbone and splits and give it the same tuning budget for its pairwise weight as we give $\epsilon$. Beating it requires higher Dice and a usable uncertainty output at equal or lower training time. For calibration we found no reported results on Lacuna for expected calibration error on these benchmarks, so all calibration baselines are run by us.
The baselines that isolate the key ingredient are three alternative candidate families, each scored by the same expected-Dice rule. The first is the level sets of the LinBP beliefs. The second is a parametric min-cut sweep over a global unary bias on the same affinity graph. The third is a two-stage version of the dynamic-cut calibrated marginals from Revisiting uncertainty in graph cut solutions, applied to our learned unaries and affinities. A second ablation swaps the LinBP head for the plain network softmax, to separate the belief component from the contour component.
Why not just…?
Why not just use a stronger attention network? Attention models refine edges locally but break under domain shift. MISNet reports that many leading models lose over 38% of their performance on unseen ETIS, and that MISNet itself still drops 16.8%. Polyp-PVT reports failures on reflections and shadows. Our head is added on top of the strongest such network rather than competing with it. If the head adds nothing on ETIS for Polyp-PVT, then better backbones already solve the problem and the proposal is wrong.
Why not just threshold the soft map more cleverly, or calibrate it with temperature scaling? This is a real threat, because the level sets of a probability map are already a nested family. The threshold-polarization post-processing in Parallel Res2Net-based Network with ReverseAttention is one version of this idea, and it trades away topology. Our argument is that level sets follow the network's probabilities, which leak exactly where contrast is low, whereas cut-tree contours follow the cheapest boundary in the affinity graph. The level-set ablation settles this directly. If level sets of LinBP beliefs match cut-tree contours on band Dice, we drop the tree and the contribution reduces to the linear belief head.
Why not just use gcDLSeg, or a parametric cut sweep? A single source-sink cut gives one hard mask and no uncertainty, and gcDLSeg names solver cost as its own bottleneck. A parametric sweep does give nested cuts. But it moves every contour together with one global bias on the unaries, which are the least trustworthy quantity in a low-contrast band. Cut-tree contours instead depend only on the affinities and on where the two cores sit. Whether this difference matters is an empirical question, and the parametric ablation answers it.
Why not just use min-marginals or standard loopy belief propagation for uncertainty? Revisiting uncertainty in graph cut solutions shows that the Kohli-Torr min-marginal heuristic gives uncalibrated probabilities and that loopy belief propagation takes 59 seconds per call. Linearized belief propagation converges by construction (The Linearization of Belief Propagation) and is differentiable, which loopy belief propagation is not. That paper's calibrated dynamic-cut marginals remain a strong competitor, so we run them as a baseline rather than dismiss them.
Proposed Experiments
The datasets are the polyp suite (Kvasir, ClinicDB, ColonDB, ETIS, CVC-300), MSD Pancreas, the AZH chronic wound set, and PH2 and ISBI 2016 skin lesions. For skin lesions, Structure Boundary Preserving Segmentation reports 91.84% Dice, which serves as an outside reference.
The metrics are whole-image Dice and IoU; Dice restricted to a fixed-width band around the ground-truth boundary; expected calibration error inside that band; AUROC of each uncertainty map (belief entropy, min-marginals, cut gap) for predicting boundary-pixel errors; and wall-clock time per image for the linear solve and for tree construction.
There are three decisive checks. First, on ETIS and ColonDB, cut-tree contours must beat both the level-set family and the parametric-cut family on band Dice. If they do not, the all-pairs component is abandoned. Second, the cut-gap map must predict boundary errors better than belief entropy. If it does not, the ambiguity claim fails even if the masks improve. Third, the LinBP head must train stably and match or beat softmax calibration at an inference cost within a small factor of the backbone. On AZH we additionally repeat the FGSM attack at $\epsilon=0.1$ used by gcDLSeg. That paper reports 68.56% Dice for gcDLSeg against 55.08% for its baseline under attack, and the test checks whether contour selection keeps that robustness.
References
- The Linearization of Belief Propagation on Pairwise Markov Random Fields
- Linearized and Single-Pass Belief Propagation
- Cut-Equivalent Trees are Optimal for Min-Cut Queries
- Breaking the Cubic Barrier for All-Pairs Max-Flow: Gomory-Hu Tree in Nearly Quadratic Time
- Approximate Gomory-Hu tree is faster than n - 1 max-flows
- Revisiting uncertainty in graph cut solutions
- gcDLSeg: Integrating Graph-cut into Deep Learning for Binary Semantic Segmentation
- Belief Propagation for Min-Cost Network Flow: Convergence and Correctness
- PraNet: Parallel Reverse Attention Network for Polyp Segmentation
- Polyp-PVT: Polyp Segmentation with Pyramid Vision Transformers
- Multi-scale information sharing and selection network with boundary attention for polyp segmentation
- Parallel Res2Net-based Network with ReverseAttention for Polyp Segmentation
- Structure Boundary Preserving Segmentation for Medical Image With Ambiguous Boundary