Glare-Aware Superpixel Tokens for Reverse-Attention Polyp Segmentation

Polyp segmentation networks find faint lesion edges with a trick called reverse attention: once the network has a rough guess of where the polyp is, it erases that region from its feature maps so that later layers must look at what remains, which is mostly the blurry rim. In colonoscopy, the bright specular reflections from wet mucosa often sit right on that rim. Erasing the polyp body therefore pushes the network's attention straight onto the glare, and the glare becomes a false edge cue. We propose to run reverse attention over a learned, shape-following partition of the image (soft superpixels, meaning irregular groups of pixels that a network learns to assign together) instead of a square grid. The partition is trained so that each group lies entirely inside the lesion, entirely outside it, or entirely on a glare spot. The network can then turn attention away from glare groups without also discarding the lesion-boundary pixels next to them.

The opportunity is narrow, but it is concrete and testable. On fixed grids and convolution windows, a patch that straddles a glare spot and a polyp margin can only be suppressed, which loses the boundary, or kept, which keeps the glare. Content-aware partitioning removes that forced choice. Known failures make the case for it. PraNet falls from 0.898 mean Dice (mDice) on Kvasir-SEG to 0.628 on the harder ETIS set, and the file's analysis of that work identifies reverse attention as magnifying specular highlights near lesions. Unsupervised superpixels, for their part, are known to leak across low-contrast boundaries (MSP).

Core Claim

A segmentation network whose reverse-attention step operates on learned soft superpixel tokens will produce fewer false positives near specular highlights, and sharper boundaries where glare touches the lesion, than (a) the same network on a pixel grid and (b) the same network after a glare-removal preprocessing step. Two conditions are necessary. The tokens must be trained with a boundary-purity objective from the training masks, not formed by color similarity. The tokens must also carry an explicit glare probability.

Each of the three directions plays a different role here. Content-aware partitioning is the mechanism. Low-contrast boundary ambiguity in colonoscopy is the regime. Anatomical and equipment noise, here specular reflection, is the specific failure we target and measure.

Research Program

The first step is diagnostic and could kill the project. We would retrain PraNet, CaraNet and MISNet on the standard Kvasir-SEG plus CVC-ClinicDB split. Then, on the held-out sets, we would measure how much of each model's reverse-attention mass and how many of its false-positive pixels fall within a few pixels of glare. Glare is labeled automatically with the saturation-threshold-plus-dilation detector used for colposcopy in Preprocessing for Automating Early Detection of Cervical Cancer, and a few hundred frames are checked by hand.

If false positives are not over-represented near glare compared with a size-matched random mask, the premise is wrong and we stop. The file contains no quantitative report of this effect; the claim about PraNet is an analytical observation. That is why this measurement comes first.

The model keeps PraNet's Res2Net-50 backbone and partial decoder so that comparisons are like-for-like. We insert a token layer at stride 8. As in SPFormer, each pixel gets a soft association to the superpixel centers in its neighborhood. Restricting associations to that local neighborhood avoids the dense pairwise cost that makes Soft Superpixel Neighborhood Attention 15 to 22 times slower than ordinary neighborhood attention.

SPFormer learns its associations only from the downstream task. Here we add a purity loss so the associations follow the annotated boundary even where image contrast gives no signal. Let $q_{ik}$ be pixel $i$'s association weight to token $k$, and let $y_i \in \{0,1\}$ be its ground-truth lesion label. The token's foreground fraction is $m_k = \sum_i q_{ik} y_i / \sum_i q_{ik}$, and the purity loss is

$$\mathcal{L}_{\text{pure}} = \frac{1}{K}\sum_{k=1}^{K} m_k (1 - m_k),$$

which is zero only when every one of the $K$ tokens is entirely lesion or entirely background. An identical term computed with the glare pseudo-label $g_i$ in place of $y_i$ pushes tokens to isolate glare spots. Because mixed tokens are penalized in training, the association network learns to predict where the boundary is. This addresses the gap left by SLIC-based methods, which need visible gradients.

Each token also has a small head that predicts a glare probability $a_k$, supervised by the token-averaged $g_i$. The decoder supplies a coarse foreground probability $s_k$ per token. Reverse attention then uses the token weight

$$r_k = (1 - s_k)(1 - a_k),$$

which is scattered back to pixels through $q_{ik}$. Erasing the polyp body therefore redirects attention to non-glare tokens, and these sit predominantly on the rim. We make a falsifiable prediction that follows from the purity term: the gain over a pixel-level glare gate should be concentrated in images where glare lies within a few pixels of the true boundary, and near zero elsewhere.

Baselines

The naive reference is a plain U-Net-style encoder-decoder on the same backbone, with no reverse attention. It shows how much reverse attention helps at all and how much it hurts near glare.

The main reverse-attention baselines are PraNet, which reports 0.898 mDice on Kvasir-SEG and 0.628 on ETIS (PraNet), and MISNet, which reports 0.903 on Kvasir-SEG and 0.918 on CVC-ClinicDB. MISNet also reports a 16.8% relative drop on ETIS, against more than 38% for competitors (MISNet).

The strongest reported number on the hardest shifted set comes from CaraNet, which adds a channel-wise feature pyramid to factorized axial reverse attention and reports 74.7% mDice on ETIS. This is the figure to beat. TransNetR, a residual-transformer decoder, is the out-of-distribution reference on PolypGen, where it reports a 2.81% mIoU margin over the next-best model. The file gives no per-center PolypGen numbers.

Fairness is controlled in three ways. Every baseline is retrained by us on the identical Kvasir-SEG plus CVC-ClinicDB training split, with the same augmentation, resolution, epoch budget and an equal hyperparameter-search budget. We report both our retrained numbers and the published ones. Our model must use a backbone of matching size.

The ablations isolate the key ingredient. The first applies the same glare gate $(1-a)$ at pixel level inside PraNet, with no tokens; this is the direct test of whether partitioning matters. The second uses tokens without $\mathcal{L}_{\text{pure}}$, which amounts to SPFormer-style associations. The third replaces learned tokens with fixed multiscale SLIC superpixels, as in MSP. The fourth keeps the tokens but drops the glare head.

Beating the field means two things. On ETIS and CVC-ColonDB the model should exceed our retrained CaraNet in mDice. Separately, on the glare-adjacent stratified subset, it should beat the pixel-level-gate ablation by a margin larger than seed-to-seed variance over five seeds.

Why not just…?

Why not just inpaint the glare before segmentation? This is the most serious threat. Laplacian interpolation (Preprocessing for Automating Early Detection of Cervical Cancer) or learned blind inpainting (Blind Inpainting with Object-aware Discrimination, which reports 47.67 dB PSNR on thyroid ultrasound) are cheap preprocessing options. The authors of the latter note, however, that inpainting can invent structure or erase lesion borders directly beneath the artifact, and glare that sits on the rim is exactly our case. We will run both inpainting pipelines in front of PraNet and CaraNet. If they match our model on the glare-adjacent subset, we will report that preprocessing suffices and treat the token method as unnecessary.

Why not just add a boundary loss or boundary branch to an existing network? Contour losses (Niu et al.) and MISNet's boundary attention sharpen edges, but they contain no notion of glare. A sharper edge detector may lock onto glare edges even more firmly. MISNet is one of our baselines, and the "tokens without glare head" ablation measures how much comes from boundary supervision alone.

Why not just augment training with synthetic glare? Pasting synthetic highlights could teach invariance without any architectural change. The lung-ultrasound study (The Role of Pleura and Adipose) shows that unconstrained networks readily latch onto non-pathological cues, with an AUC of 0.6553 unmasked against 0.7742 with the confounding tissue removed. That is evidence about a different shortcut, though, not about glare augmentation. We will train PraNet with glare copy-paste augmentation under the same budget and treat it as a full baseline.

Why not just prompt a foundation segmenter? Region-Native Visual Tokenization relies on SAM pseudo-masks and notes that they are weak where boundaries lack clear gradient steps. That is the regime here, so we expect a zero-shot box-prompted SAM to be a weak reference. We include it only as a reference point.

Proposed Experiments

Training uses Kvasir-SEG and CVC-ClinicDB. Testing covers the seen sets plus the unseen CVC-ColonDB, CVC-300, ETIS and PolypGen/BKAI-IGH. We report mDice, mIoU, 95th-percentile Hausdorff distance, frames per second against PraNet's roughly 50, and a new stratified metric: false-positive area within a band around glare, split by whether glare touches the true boundary. No reported result was found on Lacuna for glare-stratified polyp segmentation, so every baseline is re-measured on this metric.

Four outcomes are decisive. First, the diagnostic must show that baseline false positives concentrate near glare. Second, the full model must beat the pixel-level glare gate specifically on the glare-touches-boundary stratum; this would show that the partition, not the gate, does the work. Third, the purity loss must yield measurably purer tokens than unsupervised associations or SLIC on low-contrast ETIS frames, measured by the average of $m_k(1-m_k)$ on test masks. Fourth, inpainting-plus-PraNet must fall short on that same stratum.

If the second or fourth outcome fails, the honest conclusion is that a simpler gate or preprocessing suffices. That would itself be a useful negative result for the reverse-attention literature.