Structural Reverse Distillation for Finding Camouflaged Objects

A camouflaged animal is hard to see because it copies the color, brightness and texture of its surroundings. A different field, industrial defect detection, has a well-tested way to find things that do not belong. It trains a small "student" network to reproduce the internal features of a large frozen "teacher" network, using only normal images. Wherever the student fails to copy the teacher, the input is probably abnormal. This proposal applies that student-teacher setup to camouflage, treating the natural background as "normal" and the hidden animal as the anomaly. It also changes what counts as a copying failure. Existing detectors compare teacher and student feature vectors one location at a time. We compare how features co-vary across small neighborhoods, measured separately at several network depths.

The two-sentence version is this. Camouflage is built to defeat local, per-location statistics: the animal's features have roughly the same local mean and spread as the background's. What camouflage usually cannot fake is the spatial correlation pattern of the background, the way its texture continues across a region. A student trained on unlabeled natural scenes, and scored by a structural similarity measure applied separately at several depths, should therefore expose camouflaged objects that point-wise distillation misses. It should do so in a single forward pass, without the generative and retrieval stack current unsupervised methods need.

Core Claim

We claim three things. First, the structure term of a feature-space structural similarity index (SSIM, a measure that compares local mean, local variance and local cross-correlation within a sliding window) separates camouflaged pixels from background far better than point-wise cosine discrepancy between teacher and student. Second, the useful signal sits mainly in intermediate layers. Deep layers of self-supervised backbones are too coarse for small targets, and shallow layers are exactly where camouflage matches the background. Third, a student trained on unlabeled camouflage images, with a loss that ignores its own worst-reconstructed regions, can learn the background well enough to act as the "normal" model without ever seeing an object-free image.

For teacher features $T_\ell$ and student reconstructions $S_\ell$ at depth $\ell$, we use the SSIM structure term computed in a Gaussian window around location $p$:

$$s_\ell(p) = \frac{\sigma_{TS}(p) + c}{\sigma_T(p)\,\sigma_S(p) + c}.$$

Here $\sigma_{TS}$ is the windowed cross-covariance between teacher and student channels, $\sigma_T$ and $\sigma_S$ are their windowed standard deviations, and $c$ is a small stabilizing constant. The anomaly map is a weighted sum over depths of $1 - s_\ell$, each term upsampled to input resolution. The same windowed term, averaged over locations, is the training loss. Our first experiment is diagnostic and tests the premise directly by scoring each SSIM component on its own. If camouflage matches the local mean and variance terms but not the structure term, the premise holds. If the structure term does no better than the mean term, the idea is wrong and we stop.

How This Relates to Prior Work

The student-teacher mechanism comes from anomaly detection. Multiresolution Knowledge Distillation for Anomaly Detection trains a compact "cloner" to match VGG activations at several depths with mean-squared and cosine losses. Anomaly Detection via Reverse Distillation from One-Class Embedding (RD) goes further: a frozen encoder feeds a trainable bottleneck, and a student decoder rebuilds the teacher's features from deep to shallow. Because the bottleneck is fit only to normal data, it filters out abnormal content, which gives 98.5% detection AUROC and 97.8% pixel AUROC on MVTec AD. We reuse RD's architecture almost unchanged. Two things differ. Both prior methods score per location, and both assume a tightly clustered normal class of centered industrial objects, an assumption the surveys (A survey on RGB, 3D, and multimodal approaches for unsupervised industrial image anomaly detection; Foundation models and Transformers for anomaly detection: A survey) flag as failing in varied natural scenes. Rethinking Reverse Distillation for Multi-Modal Anomaly Detection adds 3D sensors and prototype memories suited to rigid parts. We deliberately stay with monocular RGB and deformable subjects.

The scoring function comes from hierarchical distillation. Structural Knowledge Distillation for Object Detection replaces point-wise feature losses with feature-space SSIM for supervised detection on COCO. It found that the cross-correlation term alone accounts for +3.2 AP of a +3.7 AP gain on RetinaNet, and that background features carry useful relational information. That result motivates us, and we supply the step it did not take: turning the structural discrepancy into a detection score, in an unsupervised setting.

On the camouflage side, one paper motivates the anomaly framing and two constrain the design. Shift the Lens: Environment-Aware Unsupervised Camouflaged Object Detection (EASE) already frames camouflage as a residual against a model of the environment. It builds that environment model with a multimodal language model, Stable Diffusion, DINOv2 prototypes, retrieval and density thresholding, at about 1.5 s per image. We keep EASE's idea and replace its pipeline with a learned student, which also removes its risk that the synthesized backgrounds do not match the real photograph. SdalsNet uses teacher-student self-distillation between two identical ViTs, matched only at the final attention maps. Its distillation serves attention refinement rather than discrepancy scoring, and it has no bottleneck and no matching at intermediate depths. DualUCOD builds spectral pseudo-labels from DINOv2 affinities and states that small objects fail because of DINOv2's coarse stride. That limitation is why our teacher includes a fine convolutional stage. Can SAM Segment Anything? When SAM Meets Camouflaged Object Detection shows that SAM relies on edge contrast in these scenes (CAMO $S_\alpha$ 0.684). We therefore report results without SAM refinement as the primary numbers.

Research Program

The teacher is frozen and combines two backbones. An ImageNet WideResNet supplies stride-4 and stride-8 maps for fine structure, as in RD, and DINOv2 supplies stride-14 semantic tokens. The student follows RD: a one-class bottleneck fuses the teacher's levels, and a decoder rebuilds each level. Training uses the 4,040 unlabeled images of COD10K-Tr and CAMO-Tr, the same pool SdalsNet trains on, and no masks. Camouflaged objects cover a minority of pixels, so the student mostly learns background, but it will partly learn the objects too.

To counter this, after a warm-up we use a trimmed loss. At each step we drop the highest-discrepancy fraction $\rho$ of locations from the loss, so the student is never pushed to fit the regions most likely to be objects. We will study how sensitive results are to $\rho$. A variant adds object-free natural texture crops to the training pool.

At test time the map is thresholded with the density-valley method EASE uses. We report results with and without an optional SAM box prompt.

Hyperparameters are chosen without camouflage labels. Level weights, window size and $\rho$ are fixed on MVTec AD and on CHAMELEON only, and then frozen for COD10K, CAMO and NC4K. This keeps unsupervised claims honest.

Baselines

The naive reference points are two maps that use no learning. One is a center-prior Gaussian map. The other is the teacher's own DINOv2 CLS-attention map, used directly as a foreground score. Any method that fails to beat these on threshold-free pixel AUROC has learned nothing about camouflage.

The strongest existing unsupervised method with a reported absolute number is SdalsNet. It reports COD10K $S_\alpha$ 0.696, against FOUND at 0.670 and TokenCut at 0.658, and CHAMELEON $S_\alpha$ 0.724. We compare with it on the same 4,040 training images, the same test splits, and the same post-processing policy. Beating it means exceeding 0.696 on COD10K $S_\alpha$ without SAM refinement. DualUCOD reportedly beats SdalsNet by 2.8% weighted F-measure on CAMO, but no absolute DualUCOD number appears on Lacuna, so we will rerun its released pipeline rather than quote it. EASE likewise has no reported absolute number on Lacuna, only "more than 10%" over FOUND and TokenCut. We will rerun it with and without SAM and compare latency against its reported 1.5 s per image.

As a reference from a different supervision regime, CAMF reaches 71.7% weighted F-measure on COD10K. It trains with salient-object masks, so we report it as a ceiling for weakly supervised transfer and do not count it as a competitor. Supervised SINet ($S_\alpha$ 0.771) is the fully supervised reference.

The ablation that isolates our key ingredient is RD trained identically, with the same teacher, data, schedule and trimmed loss, but with cosine training and cosine scoring. A second ablation crosses the training loss with the scoring function (cosine or structural each way), to tell apart "structural training" from "structural scoring." A third removes the fine convolutional levels to test the small-object claim. All learned baselines get the same GPU budget and the same label-free tuning protocol.

Why not just…?

Why not just do nearest-neighbor matching on DINOv2 patches? One could score each patch by its distance to the image's own other patches or to a memory bank of training patches, roughly EASE's self-retrieval without diffusion. This is a real threat, because DINOv2 features alone separate object and environment well enough for EASE's density-valley thresholding to work. We include it with the same DINOv2 teacher. We also build the hybrid that settles the question: assemble a nearest-neighbor "reconstruction" feature map and score it with the same structural term. If that hybrid matches our student, the contribution is the scoring function, not distillation, and we will say so. The student then keeps only a speed advantage and the fine-stride levels, which patch retrieval at stride 14 lacks, as DualUCOD notes for small objects.

Why not just run standard reverse distillation on camouflage images? That baseline is exactly our first ablation. Our prediction is that point-wise cosine discrepancy is weak on camouflage, because background-matching is designed to equalize local feature statistics. The diagnostic experiment tests this directly on COD10K ground truth before any method comparison. If cosine RD performs as well, the core claim fails.

Why not just compute SSIM in pixel space, or add frequency adapters? Pixel-space structure is precisely what background-matching camouflage suppresses: the edge gradients vanish (Fast Camouflaged Object Detection via Edge-based Reversible Re-calibration Network). Frequency adapters, as in Frequency-Guided Spatial Adaptation for Camouflaged Object Detection, need supervised training. We include a pixel-SSIM residual against a blurred copy of the image as a cheap check. It should fall near the center prior.

Proposed Experiments

The diagnostic comes first. On COD10K test images with ground-truth masks, using a student trained without labels, we compute pixel AUROC separately for the luminance, contrast and structure terms and for cosine distance, at each depth. The decisive pattern is a structure-term AUROC clearly above the other terms at intermediate depth.

The main evaluation covers CHAMELEON, CAMO, COD10K and NC4K with $S_\alpha$, E-measure, weighted F-measure, MAE, pixel AUROC and per-image latency. We report results both with and without SAM.

For the small-object analysis, we bin COD10K objects by size, using its tiny-target attribute labels, and compare the full model with the no-fine-level ablation and with DualUCOD.

For contamination, we vary $\rho$ and the share of object-free training data to measure how much the trimmed loss recovers.

The backward-compatibility check asks whether structural scoring hurts industrial detection. We retrain on MVTec AD and compare with RD's reported 98.5% detection AUROC, 97.8% pixel AUROC and 93.9% PRO. A drop of more than about one point would mean the structural score is specialized to camouflage rather than a general improvement to reverse distillation, and we would report it that way.