Segmentation networks for medical images often refine their output in two steps. First they make a rough guess at where the object is. Then a second stage looks again, concentrating on the pixels the rough guess was unsure about. The most widely copied version, reverse attention, erases the confidently predicted interior and makes later layers work on everything that remains. This works when the object has a crisp edge. It fails in the cases that matter most clinically: small, flat polyps whose color and texture almost match the surrounding mucosa. There the rough guess is often wrong, and the network does not know it is wrong. Reverse attention then spends its effort on the wrong region and never recovers. PraNet scores 0.898 mean Dice on the dataset it was trained on but 0.628 on the unseen, low-contrast ETIS set (PraNet).
We propose to decide how wide the second-look region is from the image itself rather than only from the network's confidence. Where local image contrast is high, the refinement band hugs the rough boundary. Where contrast is low, the band widens, so the second stage can search further from the rough boundary and recover structure the first guess missed. Image contrast is a measurable property of the input, so it is not miscalibrated by distribution shift the way a model's own confidence is. If we are right, a gate that uses contrast should generalize to unseen low-contrast data better than gates built from predicted probability or predicted entropy. We can test that claim directly, and it can fail.
Core Claim
Our hypothesis is that under domain shift, a segmentation model's uncertainty fails to track its boundary errors exactly where contrast is low, while a simple image-derived local contrast measure stays informative. Let $z(x)$ be the logit of the coarse foreground prediction at pixel $x$. The size of $z(x)$ roughly measures how far $x$ lies from the predicted decision boundary. Let $c(x)\in[0,1]$ be a normalized local contrast computed from the smoothed input image. We replace PraNet's erasure weight $1-P(x)$ with a band gate
$$G(x) = \exp\!\left(-\frac{z(x)^2\,(c(x)+\epsilon)^2}{\tau^2}\right),$$
where $\tau$ is a learned temperature and $\epsilon$ a small floor. When contrast is high, only pixels near the predicted boundary pass through. When contrast falls toward zero, the gate opens over a wide region. This includes a flat polyp that the coarse map scored as confident background. The entropy-style gate $4P(1-P)$ is the special case with constant $c$. That makes the comparison between the two exact.
Relation to Prior Work
Several papers motivate the problem. PraNet introduced erasure of a coarse saliency map. It leaves open what happens when that map misses the lesion. Parallel Res2Net with Reverse Attention keeps the same architecture. It cleans up uncertain gray pixels with a hand-tuned, size-thresholded polarization step after inference. That step cannot be trained and does not adapt to scale. OSFormer and ERRNet carry reverse or reversible attention into camouflaged-object detection. Both still derive the gate from the network's own prediction.
The strongest direct competitor is PraNet-V2. It replaces the algebraic inverse with separately supervised foreground and background heads, which addresses the "background is not empty" critique. Its gate, however, still comes entirely from learned predictions, so a coarse map that is confidently wrong remains confidently wrong. MISNet adds axial boundary attention. It reports a smaller drop on ETIS, but it is supervised with binary edges extracted from masks.
Two papers supply the ingredients. MM-UNet showed that range pooling (local max minus min) is a useful contrast signal inside attention. We move that signal out of learned feature space and into the input image, and we use it to scale the gate rather than as one more pooled channel. Bounding Maps showed that soft, graded spatial targets help under lesion-tissue ambiguity. This supports making the band soft rather than one pixel wide.
One paper constrains the design. NA-UNETR argues that global attention drowns faint structures. An unlimited widening of the gate could reintroduce that problem. We therefore cap the widening through $\epsilon$ and measure what happens when it is removed.
Research Program
The work has three parts.
The first part is a diagnostic study that must come before any architecture claim. We train PraNet and PraNet-V2 on the standard Kvasir-SEG plus CVC-ClinicDB split. On held-out seen data and on ETIS, CVC-ColonDB and CVC-300, we measure how well two signals predict where the boundary is actually wrong: coarse-map entropy and image-derived contrast $c(x)$. The measure is area under the curve for detecting boundary-error pixels, computed separately in a band around the ground-truth contour. Our hypothesis predicts that entropy's predictive power drops sharply from seen to unseen data, while contrast's does not. If the diagnostic shows the opposite, the proposal stops there, and the negative result is itself worth reporting.
The second part builds the gate. We compute $c(x)$ as multi-scale local intensity range on a Gaussian-smoothed, color-normalized image. Highlights above a saturation threshold are clipped, because specular reflections in colonoscopy produce spurious high contrast. The gate then replaces $1-P$ in each reverse-attention stage of PraNet. It also replaces the background-branch weighting in PraNet-V2, so we can test whether the idea adds to dual supervision rather than competing with it.
The third part is a stress test outside polyps. We use BUSI breast ultrasound, where speckle noise makes local range unreliable, and COD10K camouflage, where objects match background texture rather than intensity. Both are settings where a simple contrast measure should fail. They show where the idea's scope ends.
Baselines
The naive reference point is the Res2Net backbone with PraNet's partial decoder and no reverse-attention refinement. It shows how much any second-look stage helps on ETIS at all.
The canonical method is PraNet itself, with its reported ETIS mean Dice of 0.628 (PraNet). Beating it means a statistically reliable gain in mean Dice on ETIS across five seeds, with no loss on Kvasir.
The strongest existing method is PraNet-V2 with a PVTv2 backbone. The file reports only an 8.03% mean Dice improvement over PraNet-V1 on ETIS, not an absolute figure (PraNet-V2). We will therefore rerun it ourselves rather than quote a derived number. MISNet reports a 16.8% relative drop from seen to ETIS performance; no absolute ETIS Dice for it was found on Lacuna (MISNet). We also rerun it with the same protocol.
All methods share the same training images, augmentation, input resolution, epoch budget and an equal hyperparameter search of twenty trials, selected on a held-out portion of the seen data, never on ETIS. Beating PraNet-V2 means our gate, added to PraNet-V2 on the same backbone, improves ETIS mean Dice and boundary IoU. On BUSI, the reference point is LSSF-Net's reported Jaccard of 92.99% (LSSF-Net). There we expect at best parity.
The ablations isolate the key ingredient. The entropy gate $4P(1-P)$ holds everything fixed except that contrast is set to a constant. A shuffled-contrast control uses $c(x)$ from a different image, which tests whether any spatially varying width helps. A learned-width head predicts $c(x)$ from features instead of computing it from pixels, which tests whether the benefit comes from being image-derived and therefore resistant to shift. A no-floor variant removes $\epsilon$, which tests the global-attention concern raised by NA-UNETR.
Why not just…?
Why not just use an entropy band instead of $1-P$? This is the most serious threat, because it is a one-line change that already concentrates refinement on uncertain pixels. Our argument rests entirely on entropy being poorly calibrated on unseen low-contrast data. The diagnostic study measures exactly that, and the entropy-gate ablation measures the downstream consequence. If the entropy gate matches ours on ETIS, the contrast signal is unnecessary and we will report it that way.
Why not just feed the contrast map to the network as an extra input channel? A network given $c(x)$ as input could in principle learn the same widening behavior. If it does not, our structured gate earns its place. If it does, the contribution reduces to the contrast feature itself. We run this as an explicit ablation under the same tuning budget. We expect it to underperform under shift, because learned use of the channel is fit to the contrast statistics of the training sources, but that is an expectation, not evidence.
Why not just use PraNet-V2's dual supervision with a stronger backbone? Dual supervision fixes how background is represented but still trusts the coarse map. PraNet-V2 does report large ETIS gains from it. The relevant test is therefore additive: our gate inside PraNet-V2, on the identical backbone. If it adds nothing, the failure mode we target is already solved.
Why not just post-process uncertain pixels or add a boundary-distance loss? The polarization step in Parallel Res2Net with Reverse Attention depends on size thresholds tuned to the training distribution, and it cannot recover a lesion the network never scored as foreground. On the loss side, nnU-Net with tuned composite losses trails a locality-constrained architecture on a faint-structure CT task (NA-UNETR). That suggests losses alone do not fix where features mix. We include polarization applied to the PraNet output as a comparison point.
Decisive Checks
We report mean Dice, mean IoU, boundary IoU and HD95 on all unseen polyp sets. The result we care about most is ETIS Dice broken down by contrast quintile of the ground-truth boundary. The proposal succeeds if three things hold. First, the diagnostic shows entropy losing, and contrast keeping, its ability to predict boundary errors under shift. Second, the contrast gate beats both the entropy gate and the input-channel variant on the lowest-contrast quintile of ETIS without hurting seen data. Third, the shuffled-contrast control removes the gain. It fails if the learned-width head or the input-channel variant matches it, because then contrast is a useful feature, not a reason to change the gate. We expect it to fail on BUSI and COD10K, where intensity contrast is the wrong cue. Reporting those failures is part of the claim, because they mark the setting where image-derived gating applies.
References
- PraNet: Parallel Reverse Attention Network for Polyp Segmentation
- Parallel Res2Net-based Network with ReverseAttention for Polyp Segmentation
- OSFormer: One-Stage Camouflaged Instance Segmentation with Transformers
- Fast Camouflaged Object Detection via Edge-based Reversible Re-calibration Network
- PraNet-V2: Dual-Supervised Reverse Attention for Medical Image Segmentation
- Multi-scale information sharing and selection network with boundary attention for polyp segmentation
- MM-UNet: A multimodality brain tumor segmentation network in MRI images
- Bounding Maps for Universal Lesion Detection
- A Neighborhood Attention Transformer Network for Enhanced 3D Segmentation of the Left Anterior Descending Artery
- LSSF-Net: Lightweight segmentation with self-awareness, spatial attention, and focal modulation