Telling Lesion from Tissue by Which Texture Explains the Border

When a polyp in a colonoscopy frame has the same colour and brightness as the surrounding bowel wall, current segmentation networks have little to grip at its edge, and they fail most on exactly the small, flat lesions that matter clinically. We propose to decide each ambiguous border pixel with a comparison. A generative model of fine surface texture is asked two questions: can this pixel's fine detail be explained as a continuation of the lesion's interior, or as a continuation of the surrounding tissue? The pixel goes to whichever region explains it better. The texture model is a diffusion model, meaning a generator trained to remove noise step by step. It is trained only on unlabelled frames, and only on the high-frequency residual of each image, the fine detail left after subtracting a smoothed copy. The mean colour that fools today's segmenters is therefore removed before the question is asked.

This matters because the two communities in play treat borders in opposite ways, and neither uses what the other has learned. Semantic-guided texture synthesis learns rich generative models of what texture belongs to what material, but it treats boundaries as fixed inputs or simply masks them out. Low-contrast segmentation works hard at borders but uses only discriminative features, which carry almost no signal when contrast approaches zero. Our bet is that in the hardest cases, lesion and tissue differ in texture statistics (surface pit patterns, vessel density) even when they do not differ in colour. If so, a texture prior used as an image-specific test should beat discriminative attention precisely where current methods collapse.

Core Claim

A residual-texture diffusion prior, conditioned on spatially masked context from one image, can serve as a per-pixel boundary classifier. The classifier compares how well interior-conditioned and exterior-conditioned denoising explain each pixel in the uncertain band. Fused with a standard segmenter's output, it should improve boundary accuracy on low-contrast, small lesions, with the gain concentrated where colour contrast is low but texture contrast is not.

Concretely, let $x$ be the high-frequency residual of a frame, $x_t$ its noised version at diffusion step $t$ with noise $\epsilon$, and $\epsilon_\theta(x_t, t, c)$ the model's noise prediction given a context mask $c$ that reveals only some pixels of $x$. For a pixel $p$ in the uncertain band, the boundary evidence is

$$s(p) = \mathbb{E}_{t,\epsilon}\Big[\,\big\|\epsilon - \epsilon_\theta(x_t,t,c_{\text{ext}})\big\|_p^2 - \big\|\epsilon - \epsilon_\theta(x_t,t,c_{\text{int}})\big\|_p^2\,\Big],$$

where $c_{\text{int}}$ reveals only the confident lesion interior, $c_{\text{ext}}$ reveals only confident surrounding tissue, and $\|\cdot\|_p$ is the error restricted to a small window around $p$. Positive $s(p)$ means the interior explains the pixel better. The same $t$ and $\epsilon$ are used for both terms, so their noise largely cancels.

Relation to Prior Work

The method borrows most directly from Learning Diffusion Texture Priors for Image Restoration (DTPM). DTPM trains a diffusion model only on the residual between a clean image and its edge-preserving smoothed version, conditions it on a global ResNet-18 code, and uses it to add texture on top of a deterministic structural skeleton. We keep the residual decomposition. We change two things. The conditioning becomes spatial, a masked context map in place of an image-level code. The prior is also used as a scorer and not as a renderer. This addresses the limitation the file flags in DTPM: its conditioning has no spatial or boundary awareness, and its skeleton smears when contrast is low.

The spatial conditioning follows the logic of Recovering Realistic Texture in Image Super-Resolution by Deep Spatial Feature Transform. That paper modulates features with per-pixel scale and shift parameters derived from segmentation maps, and it shows that plain concatenation of the map washes out in deep layers. We use the same modulation to inject the context mask.

On the segmentation side, Polyper: Boundary Sensitive Polyp Segmentation is the closest work and the one we must beat. Polyper erodes and dilates a coarse mask to separate an interior from a potential-boundary band. It then lets boundary features attend to interior features through cross-attention. It is the right intuition, since the interior tells you what the lesion looks like. But the comparison is discriminative and one-sided, because it uses interior features only as keys and never asks whether the exterior explains the pixel better. The fixed morphological kernels can also erase the interior of small lesions entirely. Two lines of work likewise refine borders discriminatively and motivate our target regime rather than supplying method. Parallel Res2Net-based Network with ReverseAttention for Polyp Segmentation erases confident foreground to force attention onto borders. MISNet adds axial boundary and reverse attention branches. The file reports that competing models lose more than 38% mDice on ETIS, MISNet loses 16.8%, and these methods have little signal when mucosal contrast vanishes.

Two papers constrain the design. Benefiting from Multitask Learning to Improve Single Image Super-Resolution (SRSEG) masks out semantic loss near borders because border labels are noisy. This warns us not to train the prior on labelled boundaries, so we train it without labels. Depth-guided Texture Diffusion for Image Semantic Segmentation is the nearest cross-over. It propagates FFT high-pass texture across a depth graph to sharpen camouflaged-object boundaries. That "diffusion" is deterministic message passing with no learned texture distribution, and it needs a depth map, which colonoscopy lacks. MeshSegmenter uses synthesized texture to expose ambiguous part boundaries on 3D meshes. Its textures are invented from prompts without regard to pixel evidence, which is unacceptable diagnostically. Ours never renders texture; it only scores the texture that is there.

Research Program

The first component is the masked-context residual prior. We compute residuals by subtracting an edge-preserving smoothed copy of each frame, following DTPM. We then train a diffusion U-Net to denoise residuals inside a random target region, given visible residuals from a random context region elsewhere in the same frame. The context is injected through spatial feature modulation. Regions are drawn from superpixels and random blobs, so no segmentation labels are used. The training data are unlabelled polyp frames: the images of the training splits with masks withheld, plus EndoCV2021 images with labels ignored. The prior therefore sees more data than any labelled segmenter can.

The second component defines the uncertain band. It is the set of pixels where a coarse segmenter's predictive entropy exceeds a threshold, and it replaces Polyper's fixed erosion. Confident interior and exterior context are taken as pixels at the high and low ends of the soft mask. The interior fallback for tiny lesions is the top-k most confident pixels, so the interior can never be empty. The file names this collapse of the interior core on lesions under 6% of the frame as an open failure.

The third component is fusion. The evidence map $s(p)$, computed over K noise levels (we will sweep K from 2 to 8 to trade cost against accuracy), is combined with the segmenter's logits inside the band by a small calibration head. The head is trained on the labelled training split. Outside the band the segmenter's prediction is kept.

We will also run a diagnostic analysis. For each test lesion we measure colour contrast across the ground-truth border and residual-texture contrast across the same border, using the difference in local residual energy spectra. This lets us map where the method helps. A secondary use of the evidence map is to gate modulation in restoration models so that texture does not bleed across uncertain borders. We treat that as follow-up, not as the claim of this proposal.

Baselines

The naive reference is the coarse segmenter alone, thresholded at 0.5, with the same backbone we use to define the band. It tells us how much any refinement adds.

The strongest existing method is Polyper, because it attacks exactly our question: it resolves ambiguous borders using the lesion's own interior appearance. The file reports mDice 86.51% for Polyper on ETIS-LaribPolypDB, against 81.00% for SegT. MISNet is the second competitor, with reported mDice 0.903 on Kvasir-SEG and 0.918 on CVC-ClinicDB. Both will be retrained under the standard polyp protocol (train on Kvasir-SEG plus CVC-ClinicDB, test on those and on the unseen ETIS, CVC-ColonDB and CVC-300). They will use the same backbone as our coarse segmenter, the same augmentations, and matched hyperparameter search budgets. We also report their published numbers so our reproductions can be checked. Beating Polyper means a statistically reliable ETIS mDice gain across at least three seeds, and a larger gain on a boundary-band metric in the small-lesion stratum.

Three ablations isolate the key ingredient. Polyper with our entropy band in place of fixed morphology tests whether the gain is only from fixing the interior-collapse problem. A one-sided variant uses only the interior-conditioned error, as Polyper does, and tests whether the two-way comparison matters. Replacing the residual with the full RGB frame as the prior's input tests whether removing colour is what helps under low contrast.

Why not just…?

Why not just fix Polyper's morphological kernels? This is a real partial threat, since interior collapse on small lesions may explain much of the ETIS error. The entropy-band Polyper ablation settles it directly. If it matches our full method, the generative test adds nothing and we will say so. Our prediction is that it recovers small-lesion recall but not accuracy in low-colour-contrast borders, where Polyper's features carry no contrast.

Why not just compare local texture statistics directly, without a diffusion model? A nonparametric test is a serious alternative. One version assigns each band pixel to interior or exterior by k-nearest-neighbour distance between its local residual statistics (energy spectrum, Gram matrix of frozen VGG features) and those of the confident regions. It uses the same band and the same fusion head. Semantic-Guided Global-Local Collaborative Networks suggests pretrained features beat classical edge operators, so this baseline is strong, not a strawman. The generative prior earns its place only if it beats this test. Our hypothesis is that it will, because it models spatial continuation from context and not just pooled statistics. If it does not, the right conclusion is that the comparative framing, not the generator, is the contribution.

Why not just pretrain a segmentation encoder on the same unlabelled frames? The advantage we claim partly comes from extra unlabelled data. A discriminative encoder pretrained on those same frames with masked reconstruction, then fine-tuned inside Polyper, controls for that. It uses the same frames and a matched pretraining compute budget. If it closes the gap, the benefit is data, not test-time comparison.

Why not just use SAM? CaPro reports that SAM needs domain-specific prompt learning for low-contrast curvilinear medical structures. MeshSegmenter reports object-level errors from SAM and GroundingDINO when boundaries are ambiguous. We include box-prompted SAM, with boxes taken from the coarse segmenter, as a reference point, but we do not expect it to be the main competitor.

Proposed Experiments

The main experiment is the polyp protocol above. We report mDice and mIoU, a boundary F-score within a thin band around the ground-truth contour, and latency per frame including all K denoising passes. Results are stratified by lesion area (below and above 6% of the frame) and by measured colour contrast and texture contrast.

The decisive check is where the gain lands. If our hypothesis is right, the improvement over Polyper and the nonparametric test concentrates in lesions with low colour contrast and non-trivial texture contrast. It should be near zero where both contrasts are low, since no texture signal exists there. If the gain is uniform, or absent in the low-colour-contrast stratum, the mechanism is not what we claim.

A second check swaps the interior and exterior context masks at test time. This should flip $s(p)$ and destroy the gain; if it does not, the evidence map is exploiting something other than region-conditioned texture.

A third check transfers the whole pipeline to camouflaged object detection on CAMO and COD10K, where targets blend by design. We retrain the prior on unlabelled images from those training sets and compare against the reported Depth-guided Texture Diffusion result. Only a relative figure is available for that method on CAMO: a 9.1% F-measure gain over its baselines. We found no absolute CAMO number on Lacuna, so we will rerun it ourselves with an off-the-shelf depth estimator. This tests whether the texture-comparison idea is general or specific to mucosa.