Shift-Stable Guidance for Low-Contrast Boundary Segmentation

Many medical segmentation networks, for example those that outline colon polyps or skin lesions, work in two stages. A coarse, heavily downsampled pathway first guesses roughly where the object is. A refinement stage then uses that guess to decide which pixels deserve close attention near the edge. The coarse guess is produced by strided layers, which skip pixels as they shrink the feature map, and these layers are known to change their output when the input moves by a single pixel. We argue that this wobble does the most damage exactly where boundaries are faint. At a crisp edge, the true intensity gradient overwhelms the small errors that striding introduces. At a low-contrast edge, the two are comparable in size, so a one-pixel camera shift can move the predicted contour by several pixels.

The proposal has two parts. The first is a measurement: how much a predicted boundary moves when the input is shifted, recorded as a function of local foreground–background contrast. The second is an architecture that follows from that measurement. It confines all downsampling to the coarse guidance pathway and makes that pathway shift-stable. The edge-refinement branch never downsamples, which preserves the faint high-frequency detail that standard anti-aliasing blurs away.

Core Claim

Our central hypothesis has two parts. First, shift-induced boundary instability in low-contrast segmentation is concentrated at low-contrast boundary pixels. Second, it is transmitted mainly through the coarse location prior that guides boundary refinement, not through the refinement layers themselves.

If both hold, the usual choice between shift stability and edge sharpness is unnecessary. The guidance pathway only has to know roughly where the object is, so it can be low-pass filtered and made shift-stable at little cost. The boundary branch runs at full resolution with stride-1 convolutions, where plain weight sharing already guarantees that a shifted input gives a shifted output, apart from border effects. Global context, needed to know where a lesion should end, is added only inside the stabilized coarse pathway.

The new element is not anti-aliasing itself. It is deciding where in the network equivariance is enforced, and adding a training penalty on the stability of the guidance map specifically.

Relation to Prior Work

Four lines of evidence motivate the gap. Making Convolutional Networks Shift-Invariant Again traced shift variance to downsampling without pre-filtering, which violates the sampling limit. Why do deep convolutional networks generalize so poorly to small image transformations? showed that one-pixel shifts can flip predictions. Shift Equivariance in Object Detection showed that boxes oscillate under such shifts. A Unified Approach for Comprehensive Analysis of Various Spectral and Tissue Doppler Echocardiography reported that the same fragility affects clinical segmentation. None of these works looks at how the damage is distributed across boundary contrast.

The boundary-focused segmentation models are the systems we modify. PraNet erases its predicted foreground from feature maps ("reverse attention") so that later layers concentrate on the uncertain rim. PraNet-V2 replaces that fixed inversion with separately supervised foreground and background heads. Polyp-PVT uses a transformer encoder for global context and reports failures under light and shadow. Salient Object Detection in Low Contrast Images via Global Convolution and Boundary Refinement pairs large separable kernels with residual boundary refinement for night-time images. All four build their location prior from ordinary strided encoders and never test stability under shifts. Our change targets that shared component.

Two works supply the stabilizing machinery.

  • Translation Invariant Polyphase Sampling (TIPS) learns how to mix the sub-grids a strided layer could sample from. It adds a loss that makes shifted and unshifted representations agree. It was evaluated on classification and generic segmentation, but not on faint boundaries.
  • Reviving Shift Equivariance in Vision Transformers uses two devices. It anchors downsampling to the highest-norm sub-grid, and it replaces positional embeddings with depthwise convolutions. The anchoring gives exact stability under circular shifts. The paper tested classification only.

We reuse both mechanisms but apply them only to the guidance pathway, together with a guidance-consistency loss.

The closest existing combination is Anti-Aliasing Attention U-net (MAAU). It inserts fixed anti-aliasing pooling throughout a lightweight U-Net for skin lesions and reaches a Dice of 0.881 on ISIC 2018. MAAU applies blur uniformly, including to the features that carry the edge, and does not measure shift consistency. Our claim is that uniform blurring is the wrong placement.

Three works constrain the design.

Research Program

Diagnostic stage. We take trained PraNet, PraNet-V2, and Polyp-PVT models. For each test image we apply every integer shift within one period of the total encoder stride, using two kinds of shift:

  • circular shifts, which isolate aliasing;
  • crop-window shifts, where new content enters at the border, which is the setting where TIPS says fixed filters fail.

For each ground-truth boundary pixel we record two quantities. The first is the standard deviation, across shifts, of the distance to the nearest predicted contour. We call this boundary jitter. The second is the local contrast across the true edge.

We fit jitter as a function of contrast. We also record jitter of the intermediate guidance map, meaning the coarse foreground map used for erasure, upsampled to full size. This tests whether guidance jitter predicts final boundary jitter.

A synthetic set lets us vary contrast independently of shape. It consists of textured disks and polyps pasted on real mucosa, with foreground–background contrast swept to near zero at fixed noise.

Architectural stage. The model has three parts.

  • Guidance pathway. A Res2Net or PVTv2 encoder in which every strided operation is replaced by polyphase-anchored downsampling. The chosen sub-grid offsets are recorded and undone during upsampling, so the upsampled guidance map shifts with the input. Transformer positional encodings are replaced by depthwise convolutions, following Reviving Shift Equivariance in Vision Transformers. Global context comes from self-attention inside this pathway.
  • Boundary branch. A shallow stride-1 convolutional branch at full resolution, with few channels. It consumes the input image and the upsampled guidance, and applies PraNet-V2-style dual-supervised erasure.
  • Training loss. Standard Dice and cross-entropy losses, a boundary loss, and a guidance-consistency term:

$$\mathcal{L}_{gc} = \mathbb{E}_{x,\delta}\,\big\| G(T_\delta x) - T_\delta G(x) \big\|_1 .$$

Here $x$ is the input image, $T_\delta$ translates an image by offset $\delta$ drawn from the crop-shift distribution, and $G$ is the upsampled guidance map. The architecture already gives exactness for circular shifts. This loss covers the crop-shift case, where border content changes, and it is the part of TIPS's representation-matching loss that we carry over to dense prediction.

Baselines

Naive reference points. The first is PraNet with its standard encoder, trained with our augmentation pipeline. Its Kvasir-SEG mean Dice is reported as 0.898 and its ETIS Dice as 0.628 in PraNet. Next to it we train the same model with heavy random translation and crop augmentation. This checks whether data alone closes the stability gap.

Strongest accuracy baselines. These are Polyp-PVT and PraNet-V2 with a PVTv2 encoder. They are the strongest reported low-contrast polyp segmenters in the file.

  • Polyp-PVT reports mean Dice 0.808 on ColonDB and 0.787 on ETIS.
  • PraNet-V2 reports an 8.03% mean Dice gain on ETIS with PVTv2. The file gives no absolute value for this result.

The file reports no shift-consistency numbers on Lacuna for any polyp or lesion benchmark, so we measure consistency ourselves for every model.

Strongest stability baseline. This is the obvious combination: TIPS downsampling placed uniformly throughout the PraNet-V2 encoder, trained with its own consistency loss. Its only reported number in the file is 92.87% shift consistency on ImageNet classification.

Uniform-blur baseline. A BlurPool version of the same encoder, as in Zhang et al. and MAAU. This represents fixed anti-aliasing applied everywhere.

Ablations. Four ablations isolate the key ingredient:

  • stabilized guidance with a boundary branch that downsamples, instead of the stride-1 branch;
  • a stride-1 boundary branch with unstabilized guidance;
  • the full model without $\mathcal{L}_{gc}$;
  • the full model with zero versus reflect padding in the boundary branch.

Fairness and success criteria. Every model uses the same training split, which is the standard Kvasir-SEG plus CVC-ClinicDB split. All share the same augmentations and the same epoch budget, and hyperparameter search is capped at the same number of trials. Compute is matched within 15% in inference operations. Where our model costs more, we also report a widened baseline at equal cost.

We count the result as beating a baseline under three conditions:

  • it matches the baseline's unseen-set mean Dice (ColonDB, ETIS, CVC-300) within one point;
  • it reduces boundary jitter in the lowest-contrast quartile by at least a third;
  • the improvement holds across three seeds.

Why not just…?

Why not just augment with random shifts? Reviving Shift Equivariance in Vision Transformers reports that an augmented Twins model drops from 80.57% to 62.40% accuracy under worst-case shifts within 30 pixels. Azulay argues that augmentation teaches specific shifts rather than invariance. Those results are for classification. For thin, faint boundaries augmentation might do better, so our augmented PraNet is a real baseline, and the contrast-stratified jitter curve will show where it falls short.

Why not just drop TIPS or BlurPool into the existing encoder? This is the most serious competitor. If uniform TIPS matches our model on low-contrast jitter and on Dice, our placement argument fails. The argument for placement rests on a mechanism: filtering before downsampling removes the fine detail that separates a faint edge from its background. That reasoning is plausible but has not been measured for these tasks. The uniform-TIPS and uniform-BlurPool baselines, stratified by contrast, test it directly. If they tie with our model, we will report the diagnostic study as the main contribution.

Why not just average predictions over shifted copies at test time? Averaging over all $f^l$-periodic residues does remove circular-shift variance. At a total stride of 32 that means 1,024 forward passes, and averaging does not help when crop shifts bring new content in at the border. It is still a real threat at small budgets. We therefore include test-time averaging over 4 and 16 shifts and compare stability against inference compute. Our model must dominate the resulting cost curve, not a single point on it.

Why not just clean up boundaries afterwards? Polarization post-processing in Yu et al. uses connected-component size thresholds. Shifts that alter component sizes break those thresholds. PraNet-V2's learned dual supervision already outperforms fixed rules. We apply polarization on top of the strongest baseline and report whether it changes jitter at all.

Proposed Experiments

We train on Kvasir-SEG and CVC-ClinicDB and test on ColonDB, ETIS, CVC-300, and EndoScene. For transfer to a different low-contrast domain, we train and test on ISIC 2018 and PH2, comparing against MAAU's 0.881 Dice. The Nighttime Image saliency set, for which no reported number was found in the file, serves as a non-medical check. Metrics are:

  • mean Dice, mean IoU, and 95th-percentile Hausdorff distance;
  • a boundary F-score at a 2-pixel tolerance;
  • mask consistency under circular and crop shifts;
  • boundary jitter stratified by contrast quartile.

On the synthetic contrast sweep, we plot jitter against contrast for every model.

Three results would be decisive.

  1. Premise check. In baseline models, jitter must rise sharply as contrast falls. If jitter is flat across contrast, the premise is wrong and the architectural work stops.
  2. Mechanism check. Guidance-map jitter must explain most of the variation in final boundary jitter, which we measure with a regression across pixels.
  3. Placement check. Our model must lower low-contrast jitter more than uniform TIPS or BlurPool while losing less unseen-set Dice than they do. The ablation with a downsampling boundary branch must fall back toward the uniform baselines.