Training a network to outline polyps in colonoscopy video normally requires a gastroenterologist to trace every boundary by hand. The cheaper alternative is to let the expert draw a few quick strokes ("scribbles") and have an algorithm grow them into full masks. Growing scribbles depends on one assumption: where the image has an edge, the tissue changes. Colonoscopy images break that assumption constantly. The light source sits next to the camera, so brightness falls off sharply with depth, mucosal folds cast dark bands, and wet tissue throws off white glints. Every one of these produces a strong edge that has nothing to do with the polyp margin. The mask-growing step follows these false edges, and the network then learns from the errors.
We propose to replace the image used as the edge template in the refinement step. A guided filter is a fast, closed-form operator that sharpens a blurry prediction by copying edges from a "guidance" image. Instead of giving it raw color, we give it a log-chromaticity image: the logarithms of the color-channel ratios, which cancel any change in light intensity. We also give it a confidence map that zeroes out glints, where the physics underlying the ratios fails. Our central bet is specific. When supervision is sparse, a learned edge template cannot discover which edges are "just lighting," because scribbles carry almost no boundary information. A physics-derived template supplies that knowledge for free, so its advantage should be largest under scribble supervision and should shrink as annotation becomes denser.
Core Claim
Endoscopy is an unusually good fit for chromaticity invariance, better than the natural scenes where the idea was developed. A pixel's value in channel $c$ can be written as $I_c(x) = k(x)\, s_c\, \rho_c(x)$. Here $k(x)$ is a scalar combining light fall-off, incidence angle and shading, $s_c$ is the spectrum of the single fixed light source, and $\rho_c(x)$ is tissue reflectance. The guidance channels we use are
$$ g_1(x) = \log\frac{I_R(x)}{I_G(x)} = \log\frac{s_R\,\rho_R(x)}{s_G\,\rho_G(x)}, \qquad g_2(x) = \log\frac{I_B(x)}{I_G(x)}, $$
and in both the intensity factor $k(x)$ cancels exactly. Natural scenes are harder. A Standardized Workflow for Illumination-Invariant Image Extraction must estimate a Planckian illuminant path and sharpen sensor responses; its best sRGB path linearity is only $R = 0.920$. Real-Time Physics-Based Removal of Shadows and Shading From Road Surfaces must estimate a two-illuminant spectral direction. A colonoscope has one light of fixed spectrum, so the simpler ratio already removes shading and fall-off.
Two common camera distortions do not destroy the invariance. A power-law gamma rescales $g$ by a constant but keeps it independent of $k$. A per-frame white-balance shift adds a constant offset to $g$, which the guided filter's local affine model absorbs. What does break the model is clipping and specular reflection, where the light adds rather than multiplies. For that reason glints are handled by down-weighting them, not by the chromaticity transform.
What would be new is using this invariant as the guidance of a differentiable guided filter inside a scribble pseudo-labelling loop, together with a measurement of when it helps. The measurement is the part that matters. The obvious risk is that polyp margins may themselves be partly shading edges, because a raised polyp casts its own shadow. The chromaticity template would erase those edges. So the method keeps a gated intensity channel, and the first experiment directly measures how much boundary signal lives in chromaticity versus intensity.
Research Program
The pipeline follows the self-training loop of Learning to Segment Medical Images with Scribble-Supervision Alone. That paper expands scribbles with a random walk, trains a U-Net, refines its masks with a dense conditional random field (CRF), filters them by Monte Carlo Dropout uncertainty, and retrains. Its authors name CRF hyperparameter sensitivity as a weakness, and it was developed only on single-channel MRI. We keep the loop and the uncertainty filtering, which that paper identifies as the ingredient that prevents errors from accumulating. We replace the CRF with a guided filter layer in the style of Fast End-to-End Trainable Guided Filter. That work made the filter differentiable and fast, reporting 10–20 ms and under 1 GB for 3K images. It learns its guidance image from raw RGB with a small network, which is precisely what scribbles cannot teach.
Our guidance is the three-channel map $[g_1, g_2, \alpha\, \log \bar I]$. The third channel is log mean intensity scaled by a learnable scalar $\alpha$ initialized near zero. This lets the model re-admit intensity edges if the data demand it, and the learned value of $\alpha$ is itself a readout of how much margin information is shading. Pixels are also weighted by a glint confidence $w(x)$. It is near zero where any channel is close to saturation or where chromaticity approaches the light source's own color. Weighting pixels in the least-squares fit means glints contribute nothing to the local coefficients and are filled in from their surroundings.
The segmentation backbone still sees full RGB. As the research file notes, the guidance and the prediction being refined need not share a representation. Diagnostic color such as redness and vascular pattern is therefore never discarded; only the edge template is invariant.
A secondary, training-free test asks whether the same refiner lifts coarse patch-level predictions from a frozen vision transformer (a model that processes the image as 16×16 patches) to full resolution. The coarse predictions are built from scribble-sampled feature prototypes, as in GazeRefine: Expert Gaze as a Test-Time Prompt for Training-Free Medical Image Segmentation, which propagates labels only in patch-feature space. This test isolates boundary snapping from the effects of retraining.
Baselines
The naive reference is the same backbone trained on scribbles with a loss applied only on scribbled pixels, then bilinearly upsampled, with no refinement and no self-training. Every other number is read against it.
The most direct competitors are refiners that see raw color, run inside the identical loop. The first is the dense CRF of Can et al., the established scribble refiner and the thing we claim to replace. The second is a guided filter with raw RGB guidance. The third is the learned-guidance filter of Wu et al., which is the real threat, because it could in principle learn to ignore lighting edges. The fourth is a Lab-color affinity propagation modelled on the pixel stage of LPOSS: Label Propagation Over Patches and Pixels for Open-vocabulary Semantic Segmentation. On natural images that stage raised Boundary IoU from 14.8% to 32.1%, but it relies on Euclidean Lab distances that shading shifts.
All refiners share one backbone (a PVTv2-B2 encoder, as used by Polyp-PVT and MixPolyp), the same scribbles, the same number of self-training rounds, and the same uncertainty filter. Each also gets the same tuning budget: an equal grid over its own parameters (filter radius and regularization; CRF kernel widths and weights; Lab affinity scale), scored on a shared 20-image densely labelled validation subset of Kvasir-SEG. We also report each method's sensitivity across that grid, since stability is part of the claim.
The strongest published scribble result in the file is Segment Anything Model-guided Collaborative Learning Network for Scribble-supervised Polyp Segmentation. It reports mDice 0.857 on Kvasir-SEG, against 0.842 for its base network, using the Segment Anything Model (SAM) as a pseudo-label generator plus a rejection threshold. We reproduce its scribble protocol and, where possible, its scribbles. If those are not released, we synthesize scribbles from masks by skeletonization and report both the reproduced SAM-CLNet and our method under that protocol.
Fully supervised references bound the gap. The file reports nnU-Net at 88.41% Dice on Kvasir-SEG (via GazeRefine), and Polyp-PVT at mean Dice 0.808 on CVC-ColonDB and 0.787 on ETIS-LaribPolypDB. MixPolyp reports a weighted-average Dice of 85.9% using mixed masks, boxes and scribbles. It is not directly comparable because it uses some full masks, and it is cited only for context.
The ablations isolate the key ingredient. They are: chromaticity guidance without glint weighting; glint weighting on RGB guidance; and $\alpha$ fixed at zero versus learned.
Beating the field means three things measured on the unseen test sets (ColonDB, ETIS, CVC-300), with mDice no worse than the best raw-color refiner. First, higher Boundary IoU than the best raw-color refiner under matched budget. Second, a lower photometric bleed rate, defined below. Third, reaching or exceeding the reproduced SAM-CLNet on Kvasir-SEG without using SAM.
Why not just…?
Why not just use heavy photometric augmentation (brightness, gamma, color jitter) and let the network learn invariance? Augmentation changes global lighting. The failure here is spatially varying fall-off and fold shadows inside one frame, and the scribble loss gives almost no gradient at boundaries where those shadows sit. Polyp-PVT, trained with full masks and a large transformer, still lists overlapping light and shadow and reflective points as its main failure cases. In road imagery, Maxwell et al. report that a random forest on the illumination-free projection rose from 38% to 99% precision at 95% recall. That is a different domain, however, so it motivates the test rather than settling it. We therefore run augmentation as an additional baseline, combined with each refiner, so that "augmentation plus RGB guidance" is directly compared with "invariant guidance."
Why not just learn the guidance image, as Deep Guided Filtering already does? This is the most serious alternative. With dense masks, a learned guidance network may well rediscover shading invariance. Our claim is regime-specific, so the supervision-density sweep settles it: scribbles, boxes, 10% masks, full masks. If learned RGB guidance matches invariant guidance even at scribble level, the physics prior adds nothing and we will report that. If the gap closes as density rises, that is exactly the predicted signature.
Why not just mask glints and keep RGB guidance? Glints may account for most of the bleeding, and chromaticity does nothing for them; the glint confidence is doing that work. The ablation separating glint weighting from the chromaticity channels answers this. If glint masking alone captures the gain, the proposal reduces to a simpler and still useful result, and the log-chromaticity component is dropped.
Why not just let SAM or a frozen foundation model produce the masks? SAM-CLNet needed box augmentation and a rejection threshold to make SAM usable on polyps. LPOSS shows that patch-level predictions from vision transformers have poor boundaries without a pixel-level stage. The training-free experiment tests whether invariant guidance is a better pixel-level stage than Lab affinity on top of frozen features.
Proposed Experiments
The first and decisive check comes before any training. For every ground-truth boundary pixel on Kvasir-SEG and CVC-ClinicDB, we compute gradient magnitude in the chromaticity channels and in log intensity. We compare these with the same quantities at non-boundary edges detected by a standard edge detector. If true margins carry clearly more chromaticity contrast than fold and fall-off edges do, the premise holds. If margins are mostly intensity edges, pure invariant guidance is ruled out, and the program shifts to the gated form with $\alpha$ as its central object.
The main experiment trains on the standard Kvasir-SEG and CVC-ClinicDB split used by Polyp-PVT and SAM-CLNet, then tests on Kvasir-SEG, CVC-ClinicDB, CVC-ColonDB, ETIS-LaribPolypDB and CVC-300. It reports mDice, mIoU and Boundary IoU. It also reports a photometric bleed rate: the fraction of false-positive pseudo-label pixels lying within a few pixels of automatically detected glints or of intensity edges with flat chromaticity. This stratified metric is what ties any gain to the mechanism rather than to generic smoothing. We also report pseudo-label quality after each self-training round, which shows whether invariant guidance slows error accumulation.
The density sweep then plots the invariant-minus-learned-guidance gap in Boundary IoU against annotation density. A gap that shrinks toward zero at full supervision confirms the central claim. A flat gap means the benefit is not tied to the annotation bottleneck. Finally, a stress test simulates stronger lighting non-uniformity by applying synthetic radial fall-off and multiplicative shadow bands to test frames. By construction these leave the chromaticity guidance unchanged, so any degradation in the invariant pipeline points to backbone sensitivity rather than refinement. We report runtime and memory per frame for every refiner, since replacing the CRF is justified partly on cost.
References
- A Standardized Workflow for Illumination-Invariant Image Extraction
- Real-Time Physics-Based Removal of Shadows and Shading From Road Surfaces.
- Learning to Segment Medical Images with Scribble-Supervision Alone
- Fast End-to-End Trainable Guided Filter
- GazeRefine: Expert Gaze as a Test-Time Prompt for Training-Free Medical Image Segmentation
- LPOSS: Label Propagation Over Patches and Pixels for Open-vocabulary Semantic Segmentation
- Segment Anything Model-guided Collaborative Learning Network for Scribble-supervised Polyp Segmentation
- Polyp-PVT: Polyp Segmentation with Pyramid Vision Transformers
- MixPolyp: Integrating Mask, Box and Scribble Supervision for Enhanced Polyp Segmentation