Camouflaged Defects Show Up as Broken Agreement Between Scales

Some of the hardest defects in visual inspection look like camouflage: a hairline scratch on brushed metal, a contaminant that matches the surface texture, a flaw whose color and pattern match the part around it. Few-shot anomaly detectors are systems that learn what "normal" looks like from one to eight good images and then flag anything that deviates. They mostly assume a defect moves the image's features far from normal, and that assumption fails for these defects. This note proposes a different signal. At the location of a camouflaged defect, the fine-scale features (local texture) and the coarse-scale features (shape and context) of a frozen pre-trained network stop agreeing with each other in the way they agree on normal images. We would train a small predictor that learns, from normal images alone, how each scale predicts its neighbor. The anomaly score is the predictor's error, calibrated against the few support images. No synthetic defects are needed, and the backbone is never fine-tuned.

In two sentences: a camouflaged defect can look normal at every scale taken separately, yet the relation between scales at that spot is abnormal. We measure that relation using the top-down and bottom-up paths of a feature pyramid, and we test whether this beats per-scale distance exactly where local contrast disappears.

Core Claim

The camouflage literature explains why per-scale distances fail. When foreground and background match statistically, local edge gradients approach zero and detectors produce false negatives or fragmented masks (Concealed Object Detection, Fast Camouflaged Object Detection via Edge-based Reversible Re-calibration Network). That same literature finds that camouflaged objects still break the global continuity of a scene. A reliable signal therefore exists, but it sits in the mismatch between local texture and larger structure, not in either one alone.

Current few-shot detectors do not look there. Foundation Visual Encoders Are Secretly Few-Shot Anomaly Detectors (FOUNDAD) takes a single layer (layer 10 of a ViT-B) from a frozen encoder and trains a projector on CutPaste defects, which are image patches cut out and pasted elsewhere. It scores anomalies by distance from the normal feature manifold. Two assumptions in that design are wrong for camouflage. CutPaste teaches the projector to look for sharp pasted boundaries, the cue camouflage removes. A single layer also cannot detect a disagreement between layers.

Student-Teacher Feature Pyramid Matching (STFPM) does use several scales. It compares each scale separately, requires per-category training on many normal images, and never relates one scale to another.

Our claim is testable. On defects stratified by how well they match their surroundings, a cross-scale prediction residual should close most of the gap that per-scale methods open as contrast falls. It should cost little on ordinary, high-contrast defects.

Research Program

The backbone is a frozen DINOv2 ViT-B, the same family FOUNDAD uses. We build a three-level pyramid from an early, a middle and a late block, and pool the late blocks to coarser grids. This gives the classic feature pyramid network split: shallow maps encode where and texture, deep maps encode what and context (Feature Pyramid Networks for Object Detection). For parity with STFPM and RegAD, we also build the same pyramid from a frozen ResNet-18.

In a standard feature pyramid, the lateral connection adds shallow features into the upsampled deep path. Adding merges the two scales, and FSPNet shows this merge floods camouflaged cues with background noise (Feature Shrinkage Pyramid for Camouflaged Object Detection with Transformers). We instead turn the lateral connection into a prediction.

A small top-down network $g^{\downarrow}_l$ predicts the level-$l$ feature at location $u$ from two inputs: the upsampled level-$(l{+}1)$ features, and the level-$l$ neighbors of $u$ with $u$ itself masked out. A bottom-up network $g^{\uparrow}_{l+1}$ predicts the coarse feature from the fine neighborhood. The residual at location $u$ is

$$r_l(u) = \big\| f_l(u) - g^{\downarrow}_l\big(f_{l+1}^{\uparrow},\, f_l^{\setminus u}\big)(u) \big\|_2 + \big\| f_{l+1}(u) - g^{\uparrow}_{l+1}\big(f_l\big)(u) \big\|_2,$$

where $f_l$ is the frozen level-$l$ feature map, $f_{l+1}^{\uparrow}$ is the next-coarser map upsampled to level $l$, and $f_l^{\setminus u}$ is level $l$ with $u$ masked.

The two terms catch different failures. Suppose a camouflaged defect matches its neighbors in texture, but the deep layer encodes an object-like disturbance. Then the bottom-up term fails, because background texture predicts background context, and the observed context is something else. Now suppose the deep context is ordinary but the fine structure is subtly off. Then the top-down term fails.

The predictors are trained once, category-agnostically, on normal images from training categories that are disjoint from the test categories. This is the protocol of Registration Based Few-Shot Anomaly Detection (RegAD), which trains on disjoint categories so it can generalize to unseen ones. The predictors never see a synthetic defect.

At test time, the $k$ support images adapt the score in a few seconds with no gradient steps. We pass them through the same predictors and store their residual vectors (per level, per location) in a memory. The query's score at each location is its nearest-neighbor distance to that memory. This calibration matters: a category whose normal appearance has unusual cross-scale structure (a woven texture, a printed logo) stops raising false alarms, because its normal residuals become the reference.

The final map sums the calibrated residual over levels, alongside a plain per-level nearest-neighbor distance. The distance term keeps sensitivity to ordinary, obvious defects.

The analysis side builds the evaluation the field lacks: a camouflage score for every ground-truth defect or object. The score must not favor any detector, so it is computed from hand-crafted texture statistics, not from the tested backbone. For each defect we take color moments and local binary pattern histograms inside the defect mask and in a surrounding ring. The score is the distance between the two, normalized by variation within the ring. Using a fixed, backbone-free statistic avoids the circularity of defining "camouflaged" as "whatever DINOv2 misses." We then report every method's performance as a curve over camouflage quantiles.

Baselines

The naive reference point is a single-layer nearest-neighbor detector. It takes frozen layer-10 DINOv2 patch features, stores the support patches in a memory, and scores each query patch by its distance to the nearest stored patch. It shows how much any learned component adds over raw frozen features.

The strongest existing method is FOUNDAD. It reports 96.1% image-level AUROC on MVTec-AD and 92.6% image-level AUROC with 99.7% pixel-level AUROC on VisA in the 1-shot multi-class setting (FOUNDAD). We will rerun it with the same backbone checkpoint, resolution and support images as our method, and give its projector the same training-category data. Beating it means matching it on the full benchmarks, within one AUROC point, while clearly exceeding it on the most camouflaged third of defects.

For pose-irregular parts, RegAD is the relevant competitor. Its paper reports gains of 3–8% AUC over earlier few-shot methods on MVTec-AD and MPDD, but the file gives no absolute per-dataset figure. We will rerun it with its ResNet-18 against our ResNet-18 variant.

STFPM serves as a data-rich reference, not a few-shot competitor. It reports 0.955 image-level and 0.970 pixel-level AUROC on MVTec-AD, trained per category on the full normal set. It tells us how close few-shot methods come to full-data training.

Two ablations isolate the key ingredient. The first keeps our pyramid levels but replaces cross-scale prediction with a concatenation of all levels scored by nearest neighbor. This tests whether "multi-scale" alone explains any gain. The second is FOUNDAD retrained on camouflage-style synthetic defects: regions cut from another place on the same image, with irregular shapes and texture-matched blending. This tests whether better synthetic data alone explains any gain.

On the camouflaged-object side, there is no few-shot reference-guided baseline to compare against. FS-CDIS reports 7.35% average precision (AP) for 5-shot instance segmentation on CAMO-FS, up from 5.34% for the MTFA transfer baseline (Few-shot Camouflaged Animal Detection and Segmentation). FSPNet reports 0.851 S-measure on COD10K with full supervision. We report both as context, not as like-for-like competitors. All methods get the same shots, image resolution and hyperparameter search budget, tuned on training categories only.

Why not just…?

Why not just concatenate several frozen layers and use nearest-neighbor distance? This is the most serious threat, because it is simple and fixes FOUNDAD's single-layer limitation directly. Our argument against it is mechanistic. If a camouflaged defect sits within the normal support distribution at every level separately, concatenation still places it near normal patches, since joint nearest-neighbor distance cannot detect an unusual pairing of individually common features. Whether this matters in practice is an empirical question, and the concatenation ablation settles it. If concatenation matches our residual on the most camouflaged quantile, the core claim is false, and we would report that.

Why not just retrain FOUNDAD with camouflage-like synthetic defects? This is also a real threat. It would remove the CutPaste shortcut without new architecture. Its weakness is that any fixed recipe for making defects defines what "camouflage" means during training, and real concealed defects vary in how they hide. Our method trains on normal images only and needs no such recipe. We will run this retrained FOUNDAD directly. We will specifically check whether its gains hold on the real low-contrast MVTec-AD, VisA and MPDD defects, or only on defects resembling its own synthetic ones.

Why not just fine-tune a supervised camouflaged-object model, or prompt a foundation segmenter? The file's evidence argues against both in this regime. Transfer fine-tuning from COCO reaches only 5–7% AP in the 5-shot camouflaged setting (FS-CDIS). Zero-shot pipelines on camouflaged video reach 0.296 weighted F-measure without motion cues, and succeed (0.628) only when optical flow is overlaid as a prompt (ZS-VCOS), a cue that does not exist for static inspection images. Supervised camouflage models such as FGSA-Net need thousands of masks, and industrial defects have neither class names nor mask libraries.

Proposed Experiments

The first experiment uses the standard 1-, 2-, 4- and 8-shot protocols on MVTec-AD, VisA and MPDD. Image- and pixel-level AUROC are reported overall and per camouflage quantile. The decisive result is the shape of the curve over quantiles. Per-scale methods (naive nearest neighbor, FOUNDAD, concatenation) should degrade as camouflage increases, while the cross-scale residual should stay flatter. Where the file supplies them, reported numbers anchor our reruns; a large mismatch in the rerun would flag a setup problem before any comparison.

The second experiment tests generality beyond industrial parts with a reference-guided camouflaged-object protocol on COD10K, CAMO, NC4K and CHAMELEON. The support set consists of background-only crops taken from other images of the same habitat super-class, and the query is a full image containing a hidden animal. We report S-measure, weighted F-measure and mean absolute error. FSPNet and CAMF are listed as supervised upper references (0.851 S-measure on COD10K for FSPNet; 71.7% and 72.9% weighted F-measure on COD10K and CAMO for CAMF, Towards Real Zero-Shot Camouflaged Object Segmentation without Camouflaged Annotations). We expect to stay below the supervised numbers. The question is how much of the gap a mask-free, few-shot detector closes.

The third experiment probes the mechanism with three checks. We ablate the top-down and bottom-up terms separately. We test whether the per-location bottom-up residual correlates with the backbone-free camouflage score. We try Real-IAD Variety as a stress test, for which the file lists no reported result.

Two outcomes would falsify the proposal: concatenated multi-layer nearest neighbor matching the residual on the camouflaged tail, or the residual trailing FOUNDAD by more than a point on the full benchmarks. Either would redirect the work toward better synthetic data rather than cross-scale structure.