Difference-Guided Downsampling for Real-Time Polyp Video Segmentation

Small, flat polyps in colonoscopy video are often lost inside the network, not missed by the camera. Every stride-2 layer in a pretrained encoder averages a tiny, low-contrast lesion into the surrounding mucosa, and by the third or fourth downsampling step there is little left for the segmentation head to find. We propose to fix this where it happens. At the first downsampling stages of an ImageNet-pretrained real-time encoder, we add a pooling path that decides which pixels to keep based on local contrast, meaning how much a pixel differs from its immediate neighbours, rather than on raw intensity.

The contrast score comes from a central difference convolution: a convolution that subtracts the centre pixel from each neighbour before weighting, so it responds to edges and texture rather than brightness. A trained difference kernel can be rewritten as an ordinary convolution at inference, so the deployed network is a plain CNN with a small, fixed extra cost. It starts out exactly equal to the pretrained model, so nothing learned on natural images is thrown away at initialization. The claim to test is specific. On the SUN-SEG "Small Objects" and "Indefinable Boundaries" subsets, contrast-guided downsampling should beat both plain downsampling and importance pooling with ordinary convolutions, at matched frame rate. The gain should be largest when labelled colonoscopy data is scarce.

Core Claim and How It Differs From Prior Work

Two pieces of prior work supply the mechanism. LIP: Local Importance-Based Pooling replaces fixed pooling with a weighted average whose weights come from a small learned "logit module". It raises COCO small-object AP for Faster R-CNN from 21.9% to 24.0%. Its logit module, however, is a vanilla convolution scoring raw feature intensity. Pixel Difference Networks for Efficient Edge Detection shows that pixel-difference kernels fold into standard 3×3 convolutions after training and run at 100 FPS. It trains from scratch for static edge maps and never uses differences to decide what survives downsampling.

A second group motivates the problem. Video Polyp Segmentation: A Deep Learning Perspective introduces SUN-SEG and identifies small objects and indefinable boundaries as the two hardest attributes. Real-Time Polyp Detection in Colonoscopy Using Lightweight Transformer reaches 64.8 FPS on a Jetson Nano at 320×320 input, but reports that its aggressive compression hurts tiny and flat polyps.

The closest competitors add difference operators to pretrained models, and none of them targets the downsampling operator:

  • S-Adapter inserts central-difference adapters into a frozen Vision Transformer for face anti-spoofing under domain shift. It works on static crops and does not touch downsampling.
  • PiDiViT fuses difference features into ViT tokens to sharpen boundaries for few-shot COCO detection. Its multi-scale kernels are not designed for streaming.
  • Visible and Clear: Finding Tiny Objects in Difference Map (SR-TOD) takes a difference at the image level: the input minus a reconstruction from the bottom feature-pyramid level. It uses that map as attention before the detection head, after the information has already been lost.

Our proposal differs from all of them in one way. The difference operator sits inside the pooling weights at the moment of downsampling, and the whole module folds into ordinary convolutions for deployment.

Mechanism

Take a pre-downsampling feature map $f$ at one of the first two stride-2 stages. The importance logit at location $p$ is a hybrid difference convolution:

$$s(p) = \sum_{i \in N(p)} w_i \, x_i - \theta \, x_p \sum_{i \in N(p)} w_i ,$$

Here $N(p)$ is the 3×3 neighbourhood, $x_i$ are the input values, $w_i$ are learned weights and $\theta \in [0,1]$ is a learned mixing coefficient. With $\theta = 1$ the kernel sums to zero, so $s$ is exactly unchanged by any additive brightness offset. With $\theta = 0$ the operator reduces to LIP's vanilla logit.

The pooled output at coarse location $q$ is the importance-weighted average

$$y(q) = \frac{\sum_{p \in W(q)} e^{s(p)} f(p)}{\sum_{p \in W(q)} e^{s(p)}},$$

where $W(q)$ is the 2×2 input window mapped to $q$. The stage output becomes

$$z = \mathrm{Conv}_{s2}(f) + \gamma \cdot \mathrm{Proj}(y),$$

where $\mathrm{Conv}_{s2}$ is the pretrained strided convolution, $\mathrm{Proj}$ is a 1×1 channel projection and $\gamma$ is a scalar initialized to zero.

Because $\gamma$ starts at zero, the network at step zero is the pretrained network, and cross-domain transfer is preserved by construction. After training, the difference kernel folds into a single vanilla 3×3 kernel $k = w - \theta (\textstyle\sum_i w_i)\, e_c$, where $e_c$ is the centre indicator. The added inference cost is therefore one single-output 3×3 convolution, a softmax-weighted average and a 1×1 projection per modified stage.

The temporal side is deliberately not new. We place this encoder under the PNS+ normalized self-attention video head, which the SUN-SEG authors report at 170 FPS on a V100. This isolates the spatial contribution and keeps the pipeline real-time.

Research Program

The work has three parts.

Build and fold. We build the module into a pretrained CNN encoder under PNS+. We verify that folding is exact, meaning outputs agree to numerical precision before and after rewriting the difference kernel. We then measure latency on an RTX-class GPU and a Jetson-class device.

Transfer hypothesis. The argument for a difference parameterization is an inductive bias, not a new function class. A vanilla logit module can in principle learn a zero-sum kernel; it is just not pushed toward one. That predicts the advantage over vanilla LIP should shrink as labelled target data grows. We test this by training at 10%, 30% and 100% of SUN-SEG training labels. We also record the learned $\theta$ per stage, to see whether the network actually chooses the contrast-only regime.

Main risk. Central difference operators amplify high-frequency non-uniform structure. Specular highlights and fluid edges are exactly such structure, and TSdetector identifies corruptions of this kind as the main source of false positives in colonoscopy video. Contrast-guided pooling may simply preserve speculars. We measure this directly rather than assume it away.

Baselines

Do nothing. The naive reference is PNS+ retrained under our schedule and resolution, with the original strided downsampling. It is the natural floor because our module sits inside exactly this pipeline.

The published anchor is PNS+ at Dice 0.756 on SUN-SEG-Easy Unseen at 170 FPS on a V100, as reported in Video Polyp Segmentation: A Deep Learning Perspective. We rerun it rather than copy the number, so that data splits and seeds match.

Strongest accuracy method. This is WavePolyp, which reports Dice 87.55% and structure-measure 90.28 on SUN-SEG-Hard at 23.04 FPS on an RTX 3090. It also reports 87.36% Dice on unseen CVC-612 without fine-tuning. Its hand-designed wavelet split of high and low frequencies is the closest non-learned rival to our learned difference operator.

We will not claim to beat its absolute Dice with a much lighter model. We will make two comparisons:

  • at matched latency, with WavePolyp's wavelet aggregation transplanted into our backbone slot;
  • at WavePolyp's own operating point, to report the accuracy gap honestly.

Semi-supervised reference. In the scarce-label regime, the reference is VPSentry at Dice 83.95 on SUN-SEG-Hard with 10% labels, at 28–30 FPS on an RTX 4090. We use only its protocol, not its unlabelled-data machinery, and say so.

Key-ingredient ablation. The decisive ablation is vanilla LIP in the same slot ($\theta$ fixed to 0) with an identical parameter count, schedule and augmentation. It separates "importance pooling" from "difference-based importance". We also run $\theta$ fixed to 1, and zero logits, which reduces the added path to plain average pooling.

All variants share the backbone initialization, input resolution, training epochs and a fixed hyperparameter-search budget of the same number of trials each.

What counts as success. Beating the baselines means a Dice gain on the SUN-SEG Small Objects and Indefinable Boundaries attribute subsets over both vanilla LIP and the do-nothing model, across three seeds, at no more than 5% throughput loss.

Why not just…?

Why not just use brightness and contrast augmentation with vanilla LIP? Augmentation also teaches invariance to global brightness shifts. It is the most direct threat to the illumination argument for $\theta = 1$. We run vanilla LIP with strong photometric augmentation as a named baseline. If it matches the difference variant on the small-object subsets at every label budget, we conclude that the benefit is achievable by data rather than architecture, and we report that as the finding.

The difference variant has one structural advantage augmentation cannot guarantee: exact invariance to additive offsets, even ones outside the augmentation range. The experiment decides whether this matters in practice.

Why not just raise the input resolution? Feeding 448-pixel frames instead of 320 preserves small polyps without any new module. Real-Time Polyp Detection in Colonoscopy Using Lightweight Transformer shows how tight edge budgets already are at 320×320. The honest comparison is at matched latency: we find the largest resolution at which the unmodified model runs as fast as ours, and compare there. If higher resolution wins at equal latency, the proposal fails on its own terms.

Why not just use a wavelet split or a reconstruction difference map? WavePolyp separates frequencies with a fixed wavelet transform. SR-TOD highlights lost detail with an image-level reconstruction residual, gaining 2.1 AP on DroneSwarms. It also argues that super-resolution front ends are both slow and prone to hallucinating textures. Both approaches act on signal the downsampling step has already mixed, or they pay for an extra decoder. We transplant each into the same encoder slot at matched latency to test whether choosing what survives downsampling beats recovering or reweighting it afterward.

Why not just fine-tune a stronger pretrained backbone? PolypSegTrack shows that a DINOv2 backbone transfers very well, reaching 91.4 Dice on ETIS. That comes at a computational weight that is hard to reconcile with low-power carts. We treat it as an accuracy ceiling rather than a same-budget competitor, and report where it sits in the accuracy–latency plane next to our model.

Proposed Experiments and Decisive Checks

Training uses SUN-SEG. Evaluation covers four things:

  • Accuracy: Dice and structure-measure on the Easy and Hard unseen test sets.
  • Attribute breakdown: per-attribute scores, with Small Objects and Indefinable Boundaries as the primary endpoints.
  • Cross-domain generalization: zero-shot transfer without fine-tuning to CVC-612, to probe domain shift.
  • Throughput: measured on an RTX-class GPU and a Jetson-class device, before and after kernel folding.

The frame-level false-alarm rate on polyp-free frames is measured alongside Dice. TSdetector shows this is where corruption-driven errors appear; its reported false-positive rate on negative videos is 10.21%, versus 17.23% for its baseline. That result is for a detector on the SUN detection set and serves only as context, not as a directly comparable number. Our experiments run on SUN-SEG polyp-free frames, so no reported result on the same protocol was found in the research file.

Three checks decide the proposal:

  1. Attribute gain. The difference variant must beat augmented vanilla LIP on the two hardest attributes at matched latency. Otherwise the core claim is false.
  2. Transfer signature. That gain should be largest at 10% labels and shrink toward 100%. A flat gain would mean the mechanism is not about data-scarce transfer.
  3. Specular stress test. We measure the share of pooling weight that falls on near-saturated pixels, on clean frames and on frames with synthetic specular highlights added. We also track false alarms on polyp-free frames. If the difference logits concentrate on speculars and false alarms rise relative to vanilla LIP, the learned $\theta$ and a brightness penalty in the hybrid term become the object of study. The headline claim would then be withdrawn rather than defended.