Reconstruction-based anomaly detectors learn to rebuild normal images and flag whatever they fail to rebuild. They have two well-known failure modes, and these pull in opposite directions. If the reconstructor is too smooth, it blurs away fine scratches and cracks. Networks with this "low-pass bias" keep coarse shapes and discard sharp detail, so the defect disappears into the background. If the reconstructor is too capable, it copies the defect straight through. This "identical shortcut" also drives the error to zero. Logical anomalies add a third problem: a missing screw or a wrong part count has no local trace at all, because every individual patch still looks normal. Catching them needs a view of the whole image, which convolutions with small kernels (local receptive fields) do not provide.
We propose to fix all three with one training rule. Take feature maps from a pretrained network and move them into the Fourier domain, where every coefficient summarizes the entire image. Hide a band of frequencies, and train a network to predict the hidden band from the visible ones using normal images only. The model cannot copy what it never sees, so no identical shortcut is possible. Predicting the hidden high frequencies forces it to learn fine normal texture rather than smoothing it away. Because each coefficient is global, every prediction draws on the full image layout. At test time we cycle through the masks and map the prediction error back to pixels with an inverse Fourier transform, which gives a localization map.
Core Claim
The identical shortcut and the low-pass bias are the same quantity viewed from two sides: how much of each frequency band the reconstructor passes from input to output. Prior work tunes that quantity indirectly, with capacity limits, synthetic defects, or fixed band splits. We remove it as a free variable by masking in frequency. We claim three things. A predictor of masked spectral bands of pretrained features, trained only on normal data, will detect structural defects at least as well as frequency-decoupled reconstructors. It will close much of the gap on logical anomalies that spatial-domain feature reconstruction leaves open. And it will do this at roughly $O(N \log N)$ cost, where $N$ is the number of feature-map positions, rather than the $O(N^2)$ cost of full self-attention.
Concretely, let $X$ be a channel-wise feature map from a frozen backbone and $\hat X$ its 2D Fourier transform. Let $M$ be a binary mask over frequency coordinates that marks the visible bands, and let $g$ be the predictor. Training minimizes
$$\mathcal{L} = \mathbb{E}_{M}\,\big\| (1-M)\odot\big(\hat X - g(M\odot \hat X)\big)\big\|^2 .$$
The test-time anomaly map averages, over a fixed set of masks, the magnitude of the inverse transform of the masked-band residual:
$$r(x) = \mathbb{E}_{M}\,\Big| \mathcal{F}^{-1}\big[(1-M)\odot(\hat X - g(M\odot\hat X))\big] \Big| .$$
The masks are radial annuli plus oriented wedges. Annuli split coarse layout from fine texture. Wedges separate directional structure such as scratches and cable strands.
Relation to Prior Work
Three papers motivate the proposal by showing where anomaly signal sits in frequency.
- Rethinking Graph Neural Networks for Anomaly Detection shows that anomalies shift spectral energy toward high frequencies, which low-pass aggregation erases.
- Can Abnormality be Detected by Graph Neural Networks? learns node-adaptive filter banks to exploit that shift.
- Conditional Diffusion Anomaly Modeling on Graphs adds a high-pass residual path to a generative denoiser.
All three are graph methods that rely on anomaly labels or a supervised prior. We take only their empirical lesson, that high bands carry the signal, and apply it in an unsupervised image setting.
Three image methods constrain the design.
- OCR-GAN splits images into Gaussian frequency bands, reconstructs each with a convolutional branch, and suppresses copying through adversarial training on CutPaste forgeries. Its branches are local, and its defense against the shortcut relies on synthetic defects.
- DRÆM learns a distance function from Perlin-noise pseudo-defects. That paper itself raises the mismatch between synthetic and real defects. - Dual-path Frequency Discriminators decomposes inputs by frequency and adds a ViT discriminator for global context. It is discriminative and depends on pseudo-anomalies.
Our method uses no synthetic defects. The shortcut is blocked structurally, by masking, rather than by adversarial pressure.
The closest image method is ULSAD. It pairs a local convolutional feature reconstructor with a global attention-based branch to catch logical anomalies on MVTec-LOCO. It works entirely in the spatial domain, and it balances its two branches with hand-tuned quantile normalization. We replace the two branches with one predictor whose masks span both coarse and fine bands.
Two papers supply the method.
- Butterworth as Attention builds learnable anisotropic spectral gates with an $O(N \log N)$ global receptive field. It also argues that ViTs act as low-pass smoothers. We reuse its gate as the main block of $g$, and its elliptical gate shapes inform our wedge masks. The paper was designed for pansharpening and has never been used for out-of-distribution reconstruction.
- Spectral Gating Networks adds a gated random-Fourier-feature path to MLPs to counter spectral bias. We use it as the per-coefficient channel mixer.
Research Program
The predictor $g$ stacks three to six blocks. Each block applies a learnable anisotropic spectral gate across frequency coordinates, then a channel mixer with a gated Fourier-feature path. The mixer predicts the real and imaginary parts of the hidden coefficients. The backbone is a frozen ImageNet-pretrained ResNet, as in ULSAD, so that differences in feature quality do not confound the comparison. Masks are sampled from a fixed vocabulary of annuli and wedges, and the same vocabulary is used for both training and scoring.
The analysis centers on a measurement we call the effective transfer curve. For each frequency band, it is the ratio of residual energy to input energy, computed on held-out normal images and on images with inserted defects. This makes the unresolved tension between letting high frequencies through and copying the defect directly measurable. It also tells us which bands carry structural evidence and which carry logical evidence. Our hypothesis is that logical anomalies on MVTec-LOCO appear mainly in the lowest annuli and structural ones in the high annuli and wedges. We will test this rather than assume it.
Baselines
The naive reference point is a plain convolutional autoencoder scored with pixel-wise $\ell_2$ or SSIM. In the MVTec AD paper, this kind of model reaches image AUROC 0.86 on Cable but per-region overlap of only 0.05. It shows what happens when neither the shortcut nor locality is handled.
For logical and structural anomalies, the strongest competitor is ULSAD, with 84.1% image AUROC on MVTec-LOCO. The same paper reports 81.49% for PatchCore and 72.87% for plain DFR. We will run ULSAD's released configuration on the same backbone, image resolution, and training images, and report its throughput and memory alongside ours. Beating it means exceeding 84.1% image AUROC on MVTec-LOCO at no more than its reported 2.17 GB of GPU memory. Separate gains on the logical and structural subsets would be the informative part.
On MVTec AD, the strongest reported reconstruction-family numbers are OCR-GAN at 98.3 image AUROC and DRÆM at 98.0 image AUROC with 68.4 pixel AP. On structural defects we aim for parity within one point of image AUROC, because our contribution lies elsewhere. A pixel AP above 68.4 would count as a localization win. For VisA, BTAD, and MPDD, the file gives no reported numbers. We found no reported result on Lacuna for ULSAD on VisA, so all methods will be rerun under one protocol with a matched tuning budget. That budget is the same number of hyperparameter trials per method, selected on a held-out set of normal images only.
The key ablation isolates the masking. It is the identical predictor $g$ trained as a full autoencoder with no mask, input $\hat X$ and target $\hat X$, with its capacity matched. A second ablation keeps the masking but moves it to the spatial domain, hiding feature patches instead of frequency bands while keeping the same spectral-gate predictor. A third replaces the learnable gates with fixed Gaussian band splits in the style of OCR-GAN.
Why not just…?
Why not just mask spatial patches and reconstruct them with a ViT, as masked autoencoders do? This is the most serious threat. Spatial masking also blocks the identical shortcut, and a ViT sees the whole image, so a hidden region containing a missing screw would be "filled in" with the screw and flagged. We found no reported result on Lacuna for masked spatial reconstruction on MVTec-LOCO. Our reason to expect it to fall short is twofold. Fine texture inside a hidden patch is inherently unpredictable from its surroundings, which should give high residuals on normal textured surfaces and therefore false positives. And ViTs smooth high frequencies, per Butterworth as Attention. The spatial-mask ablation, run on the same backbone and with a ViT predictor as well, settles this. If it matches our method on both LOCO subsets, the frequency-domain claim is wrong, and the paper becomes a study of masking for anomaly detection.
Why not just bolt Butterworth spectral gating onto ULSAD's global branch? That transplant would cut cost, but it would not remove the shortcut. An unmasked reconstructor with high-frequency capacity is exactly the case where defects get copied, the tension that OCR-GAN handles only with synthetic forgeries. The unmasked-$g$ ablation is this transplant in its cleanest form. The transfer curve shows whether its residual energy on inserted defects collapses in the high bands.
Why not just use a memory bank of normal patches? PatchCore reaches 81.49% on MVTec-LOCO at nearly 7 GB, per ULSAD. Because it compares isolated patches, it cannot represent a misplaced but locally normal part, as argued in Contextual and Relational Reasoning for Logical Anomaly Detection. We include it to keep the memory comparison honest.
Why not just train on synthetic defects? DRÆM and OCR-GAN show that this works well on textures. Both papers, and DFD, note that pseudo-defects differ from real ones and do not express layout violations. We keep DRÆM as a structural baseline. The LOCO logical subset is where synthetic training should fall behind.
Proposed Experiments and Decisive Checks
Training uses only the normal training images of MVTec AD, MVTec-LOCO, VisA, BTAD, and MPDD. We report image AUROC, pixel AUROC and AP, and per-region overlap, plus GPU memory and images per second on a single GPU.
Three checks decide the proposal. First, on the MVTec-LOCO logical subset, masked spectral prediction must beat ULSAD and the spatial-mask ablation. Without that, the global-coefficient argument fails. Second, the unmasked-$g$ ablation must show a measurable collapse of defect residual in the high bands of the transfer curve that the masked model does not show. That would confirm masking is what resolves the trade-off between high-frequency capacity and the shortcut. Third, per-mask attribution must show that low annuli drive logical detection and high bands and wedges drive structural detection. If instead all bands contribute equally, the frequency decomposition adds nothing beyond masking alone, and we will report it that way.
References
- Rethinking Graph Neural Networks for Anomaly Detection
- Can Abnormality be Detected by Graph Neural Networks?
- Conditional Diffusion Anomaly Modeling on Graphs
- Omni-Frequency Channel-Selection Representations for Unsupervised Anomaly Detection
- DRÆM - A discriminatively trained reconstruction embedding for surface anomaly detection
- Dual-path Frequency Discriminators for Few-shot Anomaly Detection
- Revisiting Deep Feature Reconstruction for Logical and Structural Industrial Anomaly Detection
- Butterworth as Attention: Anisotropic Spectral Gating for Pansharpening
- Spectral Gating Networks
- MVTec AD - A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection