Medical segmentation models are often trained with a boundary loss: a penalty that grows with how far predicted foreground lies from the annotated outline. This penalty treats every stretch of the outline as equally trustworthy. In low-contrast images, that assumption is wrong. Where a tumor fades into pancreas, or a coronary artery has nearly the same intensity as the surrounding heart muscle, the annotator's contour is partly a guess, and a distance-based loss pulls the network hard toward that guess. We propose to measure, from the image itself, how visible the boundary is at each point of the annotated contour. The measure uses a parameter-free neighborhood statistic: how different the intensities are just inside versus just outside the contour, relative to local noise. We then use it to give the boundary loss a spatially varying tolerance band. Where the boundary is clearly visible, the loss behaves as usual. Where it is faint, the loss ignores small displacements and leaves those pixels to the overlap and per-pixel terms, while still correcting gross errors.
The idea takes a contextual feature operator that prior work places inside the network and moves it into the training objective. It targets the regime where current methods are weakest: small, scarce, low-contrast datasets. That regime includes 20-volume non-contrast CT, where the best reported model reaches only 45.64% Dice and depends on high-contrast pretraining. If the idea works, it should give lower boundary error and fewer broken thin structures without extra parameters, without pretraining corpora, and without learned weighting schemes that can overfit small data.
Core Claim
Our claim is that distance-based boundary supervision in low-contrast images fails because of label noise concentrated exactly where contrast is lowest, not only because the network lacks capacity. A tolerance that scales with locally measured boundary contrast should therefore beat both a uniform boundary loss and a uniform tolerance. Making supervision contrast-aware should matter more than making the architecture contrast-aware.
Concretely, let $I$ be the input image after light smoothing, and let $\phi_G(x)$ be the signed distance from pixel $x$ to the ground-truth boundary (negative inside, positive outside). Let $b(x)$ be the nearest boundary point to $x$. For each boundary point $b$ we compute a local contrast
$$c(b) = \frac{|\mu_{\text{in},r}(b) - \mu_{\text{out},r}(b)|}{\sigma_r(b) + \epsilon},$$
where $\mu_{\text{in},r}$ and $\mu_{\text{out},r}$ are mean intensities of the ground-truth interior and exterior pixels within a window of radius $r$ around $b$. Here $\sigma_r$ is the intensity standard deviation in that window, and $\epsilon$ is a small constant. The radius $r$ follows the dynamic window scaling idea of Neighborhood Self-Dissimilarity Attention for Medical Image Segmentation. The tolerance is $\tau(b) = \tau_{\max}\exp(-c(b)/c_0)$, where $\tau_{\max}$ is a maximum band width and $c_0$ sets how quickly the band shrinks as contrast rises. The boundary loss is that of Kervadec et al. with a dead zone:
$$L_B = \frac{1}{|\Omega|}\sum_{x\in\Omega} s_\theta(x)\,\mathrm{sign}(\phi_G(x))\max\big(|\phi_G(x)| - \tau(b(x)),\,0\big),$$
with $s_\theta(x)$ the predicted foreground probability and $\Omega$ the image domain. The total objective is $L = L_{\text{DiceCE}} + \lambda L_B$. Both $c$ and $\phi_G$ are computed once per training image, at the same cost as the distance map already required by boundary losses.
Relation to Prior Work
Three works motivate the problem. Boundary loss for highly unbalanced segmentation introduced the distance-map integral we modify. Combined with Generalized Dice Loss, it raised ISLES Dice from 0.575 to 0.656, but it weights all contour points identically. Active Boundary Loss for Semantic Segmentation moves predicted boundaries along distance-transform directions. It finds those boundaries via KL-divergence peaks between neighboring pixels, and it was validated only on sharp natural-image edges. In wide, gradual transitions those peaks become diffuse, so we treat it as a baseline that is likely to struggle rather than as a building block. A Neighborhood Attention Transformer Network for Enhanced 3D Segmentation of the Left Anterior Descending Artery documents the setting where the label-noise argument bites hardest. Its LAD artery in non-contrast CT is hard to tell from myocardium by intensity, and inter-observer agreement is low. That paper weights a Dice-Focal plus Hausdorff loss with one learned global uncertainty per term. We instead vary supervision per pixel, using a quantity fixed by the image rather than learned.
Two works supply method. Neighborhood Self-Dissimilarity Attention for Medical Image Segmentation computes local mean and variance in scaled windows to emphasize dissimilar pixels inside the network, trained with ordinary losses. We reuse the statistic but apply it to supervision. A Medical Image Segmentation Method based on Multi-scale Features and Contour Loss Constrain (S) adds a contour branch supervised by Canny edges of the mask with a fixed 90/10 weighting. Its reduction of spleen 95% Hausdorff distance (HD95) from 7.5744 to 5.8814 shows that boundary supervision helps on CT, but its binary contour target has no notion of where the contour is uncertain.
Two works constrain the design. Combating Uncertainty with Novel Losses for Automatic Left Atrium Segmentation pushes in the opposite direction: its overlap loss forces crisper boundaries everywhere, reaching 92.24% Dice on the 2018 atrial challenge. We must show that relaxing boundaries locally does not cost the crispness that loss buys. The finding of Multi-scale Information Sharing and Selection Network with Boundary Attention for Polyp Segmentation is that many models lose more than 38% Dice on concealed ETIS polyps, against 16.8% for MISNet. This tells us the low-contrast subset is where the effect should appear, so we stratify all results by measured contrast.
Research Program
The work has three parts. The first is the loss itself, implemented in 2D and 3D. We pre-compute contrast maps and add a controlled choice of $\tau_{\max}$ (in units of pixel spacing) and $c_0$ (set to the median contrast of the training set, so neither needs per-dataset search). We train with the same monotonic warm-up of $\lambda$ that Kervadec et al. use, so differences cannot be attributed to scheduling.
The second part is a controlled label-noise study, which tests the mechanism directly. We take datasets with relatively clean, high-contrast boundaries: the spleen CT and the ACDC cardiac MRI data used by Niu et al., and ImageCAS coronary CT angiography. In randomly chosen patches along the contour, we blend intensities across the boundary toward a common mean to lower contrast. Within those patches only, we perturb the label contour with smooth random displacements of a few voxels. Training uses the corrupted images and labels, and evaluation uses the clean labels. If our account is right, a uniform boundary loss should overfit the perturbed contours, and the contrast-aware band should recover the clean contour better. The band should also do better than a uniform band of matched average width, which gives up precision in high-contrast regions where it is not needed.
The third part is evaluation on natively low-contrast benchmarks, trained from scratch. Results are reported overall and stratified into contrast terciles of contour points. Thin structures also get a connected-component count against ground truth.
Baselines
The naive reference is a U-Net trained with nnU-Net's default Dice plus cross-entropy and its automatic configuration. On LAD-SEG, the file reports nnU-Net about 3.1 points below NA-UNETR's 45.64% Dice. Our method should beat nnU-Net trained from scratch on boundary error, especially in the lowest-contrast tercile, without hurting Dice.
The strongest loss-level competitor is Generalized Dice plus scheduled boundary loss, from Boundary loss for highly unbalanced segmentation. It reports Dice 0.656 on ISLES and 0.748 on WMH (from 0.575 and 0.727), plus a 10% Hausdorff reduction on WMH. It is the direct parent of our loss, so it isolates exactly what the tolerance band adds. We run it with the same backbone, augmentation, epochs, and $\lambda$ schedule. Beating it means lower HD95 on ISLES or WMH at equal or higher Dice, with the gain concentrated in low-contrast contour regions.
The strongest system-level competitor on non-contrast CT is NA-UNETR from A Neighborhood Attention Transformer Network for Enhanced 3D Segmentation of the Left Anterior Descending Artery. It reports 45.64% Dice and 38.16 mm HD95 on LAD-SEG, after pretraining on 1,000 ImageCAS volumes and low-rank adaptation. Because that result uses pretraining, the fair comparison is to move its uncertainty-weighted Dice-Focal plus Hausdorff loss onto our backbone and train both from scratch with the same tuning budget. As a separate, explicitly unfair upper reference, we also report our loss applied within its pretraining pipeline. Beating its from-scratch loss counts as success; approaching 45.64% without pretraining would be a strong result.
We also run Active Boundary Loss with cross-entropy, following Active Boundary Loss for Semantic Segmentation, as the main directional boundary method. On the architecture side, we run a backbone equipped with the dissimilarity attention of Neighborhood Self-Dissimilarity Attention for Medical Image Segmentation. The file reports a 4.99% mean Dice gain on Synapse but no absolute value, so no reported absolute result was found on Lacuna for that baseline. We run it with both the standard loss and our loss.
Three ablations isolate the key ingredient. The first is a uniform tolerance band whose width equals the average of our adaptive band. The second is a shuffled contrast map, which tests whether the image-derived signal matters at all. The third is an inverted mapping, which widens the band at high contrast and tests the direction of the hypothesis. All methods share data splits, compute, and an equal number of hyperparameter trials.
Why not just…?
Why not just put the dissimilarity-attention network together with an existing boundary loss? This is the obvious combination of the two literatures, and it is our baseline. Our hypothesis is that the architecture cannot fix supervision that is itself noisy in low-contrast bands: a network better at seeing faint edges still receives gradients pulling it toward guessed contours. The two-by-two experiment settles this. It crosses architecture (standard versus dissimilarity attention) with loss (uniform versus contrast-aware). If attention plus uniform boundary loss matches attention plus our loss, our claim fails.
Why not just learn per-pixel uncertainty weights instead of computing contrast? This is a real threat. A heteroscedastic weighting can learn to down-weight ambiguous pixels without any hand-built statistic, and it generalizes the global weighting used by NA-UNETR. Our argument is that on 20 to 100 training volumes, a learned per-pixel weight can also down-weight hard but correctly labeled pixels, effectively learning to give up. A fixed, image-derived map cannot do that. We include learned per-pixel weighting as a baseline in both the label-noise study and LAD-SEG. If it matches our method, we will report the contrast map as an interpretable but unnecessary prior.
Why not just smooth labels or use a uniform tolerance everywhere? Uniform softening also reduces sensitivity to contour noise, and it is cheaper. It should, however, cost precision on high-contrast boundaries, where tight supervision is both reliable and useful. That is what the overlap-loss results of the atrial-segmentation work suggest. The matched-width uniform-band ablation tests this directly, measured on the high-contrast tercile.
Why not just use nnU-Net and accept the result? The file's evidence suggests standard compound losses leave substantial boundary error on low-contrast targets, as the spleen HD95 and ISLES gaps show. nnU-Net nonetheless stays in every table as the reference our method must beat.
Proposed Experiments
The decisive check is the controlled label-noise study. Contrast-aware tolerance should beat both the uniform boundary loss and the matched uniform band on clean-label HD95 inside corrupted patches. It should be no worse outside them. The shuffled-map control should erase the gain. If the inverted mapping wins instead, the hypothesis is wrong in direction, and we report that.
Native benchmarks follow. On LAD-SEG, trained from scratch, we report Dice, HD95, and connected-component counts, against the 45.64% Dice and 38.16 mm HD95 reference. On ISLES and WMH, we report against 0.656 and 0.748 Dice. On spleen CT, we report against an HD95 of 5.8814. For the low-contrast case among polyp datasets, we use ETIS, training on Kvasir-SEG and CVC-ClinicDB and reporting the relative Dice drop against MISNet's 16.8%. Every table is stratified by contour-contrast tercile.
The prediction is specific: gains concentrate in the lowest tercile and vanish in the highest. Uniform improvement across terciles would point to a regularization effect rather than the label-noise mechanism we propose. We would report it as such.
References
- Neighborhood Self-Dissimilarity Attention for Medical Image Segmentation
- Boundary loss for highly unbalanced segmentation
- Active Boundary Loss for Semantic Segmentation
- A Neighborhood Attention Transformer Network for Enhanced 3D Segmentation of the Left Anterior Descending Artery
- A Medical Image Segmentation Method based on Multi-scale Features and Contour Loss Constrain (S)
- Combating Uncertainty with Novel Losses for Automatic Left Atrium Segmentation
- Multi-scale information sharing and selection network with boundary attention for polyp segmentation