Healing Consistency Maps for Low-Contrast Anomaly Margins

Many unsupervised anomaly detectors work by "healing". A generative model is trained only on normal images, then asked to repaint a test image as if it were normal. Wherever the repaint differs from the input, something is flagged as abnormal. The approach needs no annotated lesions, which is why medical imaging uses it heavily. It fails, however, where it matters clinically: at the soft edges of lesions that barely differ in brightness from surrounding tissue. There the difference between input and repaint is small. It is also indistinguishable from the random differences the generator introduces everywhere, so the thresholded mask either misses the margin or spills into healthy tissue. One reported number shows how bad this gets. A recent masked diffusion method reaches only 10.71% Dice on subtle multiple sclerosis lesions (mDDPM).

This note proposes asking a different question about each pixel. The usual question is how different the pixel is after healing. Ours is whether the pixel gets healed in the same direction every time we heal the image, across random seeds and across amounts of added noise. A real but faint lesion margin should be repainted consistently toward normal tissue. A hallucinated difference in healthy tissue should change sign and size from run to run. The fraction of noise levels at which a pixel is reliably healed gives a continuous score from lesion core to perimeter, with no boundary labels. We then use that score as a soft training target to distill the slow multi-run procedure into a single fast network.

Core Claim

A diffusion model is a generator that learns to turn noise into images by repeated denoising. Diffusion-based anomaly localization adds a chosen amount of noise to the input and denoises it with a model trained on healthy scans. It then subtracts the result from the input (Bercea et al.; Wolleb et al.). These papers document a "noise paradox". With too little noise, the model copies the anomaly back. With too much, it forgets the patient's anatomy and creates false positives everywhere. Existing methods tune a single noise level, or mask patches at random (mDDPM), and then threshold one residual map.

Our claim is that the two failure modes of the noise paradox differ in reproducibility, not only in magnitude. False positives caused by high noise come from the generator filling in identity it has forgotten, and they vary across random seeds. The true anomaly residual, even when faint, points consistently toward healthy intensity. We measure this per pixel and per noise level.

Let $r_{t,s}(p)$ be the signed residual at pixel $p$ after noising to level $t$ with seed $s$ and denoising. Let $m_t(p)$ and $v_t(p)$ be its mean and standard deviation over $S$ seeds. We define a consistency score

$$ c_t(p) = \frac{|m_t(p)|}{v_t(p) + \epsilon}, $$

where $\epsilon$ is a small constant. We calibrate each level against healthy data by setting $\tau_t$ to the 99th percentile of $c_t$ over pixels of held-out healthy scans. The healing consistency map is then

$$ h(p) = \frac{1}{K}\sum_{k=1}^{K} \mathbf{1}\left[c_{t_k}(p) > \tau_{t_k}\right], $$

the fraction of $K$ noise levels at which the pixel is reliably healed. Lesion cores should score near 1. Faint margins, which only become healable once enough noise hides them, should take intermediate values. Healthy tissue should stay near 0 by construction of $\tau$.

This graded structure is what Bounding Maps had to supply by hand. That work replaced binary lesion boxes with linearly decaying soft targets and raised DeepLesion sensitivity from 82.43% to 86.28%, but it needed box annotations. We obtain a comparable gradient from the normal-data model alone.

Research Program

The first component builds the map. We train a standard denoising diffusion model on healthy brain MRI (IXI, the healthy source used by mDDPM). We use stochastic partial noising rather than deterministic encoding. The deterministic scheme in Wolleb et al. removes the seed variance our score depends on, which is itself a design constraint the note makes explicit. We sweep $K$ noise levels (planned $K=6$) and $S$ seeds (planned $S=4$). We use a short sampling schedule so that the 24 reconstructions per slice cost roughly what one long-trajectory reconstruction costs in prior work. The closest related work outside medicine aggregates residuals from a frozen generator at several corruption ratios, used as features for audio deepfake detection (Multi-Ratio DiT Residuals). That work concatenates magnitudes for a supervised classifier. We neither use labels nor rely on magnitude, and our target is spatial localization.

The second component removes the inference cost and the annotation requirement together. The multi-run procedure is too slow to deploy; the file cites 158 seconds per slice for a single diffusion reconstruction (Wolleb et al.). We therefore run it once, offline, on a pool of unlabeled patient scans. We then train a feed-forward U-Net to predict $h(p)$ from the image in one pass.

The loss is a soft cross-entropy against $h$. Each pixel is weighted by how far $h$ sits from the ambiguous middle, so uncertain margins cannot dominate early training. This follows the lesson from Can et al. that uncertainty-aware relabeling, rather than spatial post-processing, kept pseudo-labels from reinforcing errors at tissue interfaces. It also answers the error-amplification problem that the file flags for hard pseudo-masks. The unlabeled patient pool requires no expert contact with any image. This is the annotation regime targeted by PathoGAN, which reached about 72.9% Dice on BraTS 2017 from image-level tags but showed boundary outliers along low-contrast edges.

The third component is analysis. We stratify every ground-truth lesion pixel by local contrast, defined as the absolute intensity difference between the pixel and the median of healthy-labeled tissue in a surrounding ring. We also stratify by distance to the lesion contour. The core prediction is that our gains concentrate in the low-contrast, near-contour strata. If gains instead appear uniformly, the method is simply a better detector, not a margin method, and the note's claim is wrong.

Baselines

The naive reference point is the single-level absolute residual from the same diffusion model, at its best validation noise level, thresholded at the healthy 99th percentile. It shares every component with our method except the consistency score, so it anchors all comparisons.

The strongest existing unsupervised competitor on these benchmarks is mDDPM, a masked diffusion model trained on IXI with spatial and frequency patch masking. It reports 53.02% Dice and 59.04% area under the precision-recall curve (AUPRC) on BraTS21, and 10.71% Dice on MSLUB. We will rerun it on our preprocessing, with the same training data, the same GPU budget and an equal hyperparameter search budget, and report both its published and reproduced numbers. Beating it means exceeding the reproduced Dice on both datasets by more than seed-to-seed spread across three training runs. It also means clearly lowering the 95th-percentile Hausdorff distance, for which no reported result was found on Lacuna for mDDPM.

A discriminative competitor is DRÆM, which trains a second network on synthetic Perlin-noise anomalies to read input and reconstruction jointly. We include it because its learned comparison is the strongest argument that hand-designed residual scores are unnecessary. It will be trained on the same IXI data using the ADer toolbox implementation where available.

Two ablations isolate the key ingredient. The first averages residual magnitudes over the same $K \times S$ reconstructions without dividing by seed variance. This tests whether consistency, rather than ensembling, is what helps. The second distills a hard thresholded map into the same U-Net, which tests whether graded targets matter. A final ceiling is a U-Net trained with full BraTS masks, reported only to show the remaining gap.

Why not just…?

Why not just average residuals over several noise levels and seeds? This is the most serious threat, because it uses the same reconstructions and removes most of the generator's random error by averaging alone. Our argument is that averaging shrinks healthy-tissue noise but leaves no principled per-level threshold. It also dilutes faint margin residuals that appear at only a few levels. That is an argument, not evidence, and the averaging ablation above settles it. If averaged magnitude matches our map on low-contrast strata within seed spread, the consistency score adds nothing and we would report that. The distillation component would then be the remaining contribution.

Why not just clean up the residual map with a conditional random field? A conditional random field is a classical smoother that snaps masks to image edges. In weakly supervised CT co-segmentation, dense CRF raised precision but caused a sharp drop in recall. Can et al. found CRFs hyperparameter-sensitive. Low-contrast margins are exactly where image edges are weakest, so snapping to edges should hurt most there. We will nonetheless run a dense CRF tuned on the same validation budget on top of the naive residual and compare it in the low-contrast stratum.

Why not just use a feature-based detector such as a memory bank or reverse distillation? Feature-space methods are fast and lead industrial benchmarks; FastFlow reports 99.4% image AUROC on MVTec AD (Benchmarking survey). SCRD reports 98.88% AUC on a brain tumor MRI dataset, and diffusion time estimation reduces to nearest-neighbor scoring (DTE). These methods score downsampled feature grids, however, and produce no healed image. Their spatial resolution is the limiting factor at margins. We will run SCRD on IXI to BraTS21 and MSLUB. If it matches us on boundary metrics, the case for pixel-space healing at margins fails.

Proposed Experiments

The main experiment trains on IXI and tests on BraTS21 and MSLUB. It reports Dice, AUPRC, 95th-percentile Hausdorff distance, and Dice within a 3-pixel band around the true contour, each broken down by local-contrast tercile.

The decisive check is the contrast-stratified comparison against the averaging ablation. The method succeeds only if it wins in the lowest-contrast tercile and the near-contour band.

A second check tests calibration of the graded map. Among true lesion pixels, $h(p)$ should increase monotonically with distance from the contour. We measure this with rank correlation, and a flat relationship would refute the claim that the map grades margins.

A third check measures the cost of distillation. The single-pass U-Net should retain most of the offline map's boundary-band Dice while running in well under a second per slice.

As a transfer probe, we apply the pipeline to low-contrast MVTec AD categories and compare against DRÆM's reported 68.4 pixel average precision. We treat this as secondary, because the benchmarking survey notes that MVTec is near saturation and limited by annotation inconsistency.