Source-linked AI summary
Omni-frequency Channel-selection Representations for Unsupervised Anomaly Detection
Yufei Liang, Jiangning Zhang, Shiwei Zhao, Runze Wu, Yong Liu, Shuwen Pan
TL;DR
Unsupervised anomaly detection seeks practical methods that avoid costly abnormal or extra training data, while reconstruction-based methods remain limited by low performance. OCR-GAN addresses this gap with frequency decoupling and adaptive channel interaction, achieving 98.3 detection AUC on MVTec AD without extra training data and surpassing reported baselines.
Problem
Reconstruction-based anomaly detection is practical because it requires only normal samples and no extra training data, but existing methods have low performance.
Method
OCR-GAN decouples input images into frequency bands for parallel omni-frequency reconstruction and adaptively selects channels to interact across branches.
Results
98.3 detection AUC on MVTec AD without extra training data surpasses the SOTA reconstruction-based method by +18.3↑ and the SOTA method by +0.3↑.
Takeaways & Limitations
OCR-GAN achieves new SOTA results on both sensory and semantic anomaly detection tasks without extra training data.
Abstract
from arXiv · showhide
Density-based and classification-based methods have ruled unsupervised anomaly detection in recent years, while reconstruction-based methods are rarely mentioned for the poor reconstruction ability and low performance. However, the latter requires no costly extra training samples for the unsupervised training that is more practical, so this paper focuses on improving this kind of method and proposes a novel Omni-frequency Channel-selection Reconstruction (OCR-GAN) network to handle anomaly detection task in a perspective of frequency. Concretely, we propose a Frequency Decoupling (FD) module to decouple the input image into different frequency components and model the reconstruction process as a combination of parallel omni-frequency image restorations, as we observe a significant difference in the frequency distribution of normal and abnormal images. Given the correlation among multiple frequencies, we further propose a Channel Selection (CS) module that performs frequency interaction among different encoders by adaptively selecting different channels. Abundant experiments demonstrate the effectiveness and superiority of our approach over different kinds of methods, e.g., achieving a new state-of-the-art 98.3 detection AUC on the MVTec AD dataset without extra training data that markedly surpasses the reconstruction-based baseline by +38.1 and the current SOTA method by +0.3. Source code is available at https://github.com/zhangzjn/OCR-GAN.
I. INTRODUCTION
Unsupervised anomaly detection must balance practical training requirements against reconstruction performance. OCR-GAN improves reconstruction-based detection by separating frequency information and enabling adaptive interaction across frequency branches.
- Problem: Sensory anomaly detection addresses defects under covariate shift, whereas semantic anomaly detection concerns images from different semantic distributions.This work focuses on sensory anomaly detection and also evaluates a related semantic anomaly detection dataset.
- Problem: Existing unsupervised methods include density-based, classification-based, and reconstruction-based approaches with different requirements for pretrained models and extra training data.Reconstruction methods use interpretable reconstruction error and require neither pretrained models nor extra training data.
- Problem: Reconstruction-based methods are practical because they use only normal samples, but current versions without extra training data have low performance and limited expressive power.The paper frames improving reconstruction ability as its central challenge.
- Approach: OCR-GAN uses a Frequency Decoupling module to obtain different frequency bands and reconstruct them with multiple parallel branches.The framework is motivated by differences between normal and abnormal frequency distributions.
- Approach: Its Channel Selection module adaptively selects channel features to enable interaction among multiple frequency branches.The module addresses complementary information across frequency bands while considering model efficiency.
II. RELATED WORK
Unsupervised anomaly detection methods primarily use density estimation, classification boundaries, or reconstruction. Related approaches often rely on pretrained features, while reconstruction methods avoid extra data but face expressiveness and computational challenges.
- Method categories: Anomaly detection methods are mainly divided into density-based, classification-based, and reconstruction-based approaches.Density-based methods model normal-data likelihood, while classification-based methods learn normal-data boundaries.
- Density-based methods: Density-based methods estimate normal-data distributions and compare test embeddings with those distributions.Parameter density estimation uses reference distributions, whereas normalizing flows learn bijective transformations but incur significant computation costs.
- Classification-based methods: Classification-based methods identify boundaries around normal data using one-class classification or self-supervised proxy tasks.Their feature extraction commonly depends on pretrained models.
- Reconstruction-based methods: Reconstruction-based methods reconstruct inputs and use reconstruction error as an interpretable anomaly score without pretrained models or extra training data.Their reconstruction ability can nevertheless be weaker than that of other approaches.
C. Reconstruction-based methods
Reconstruction-based anomaly detection is intuitive and data-efficient, but strong generators may reconstruct abnormal images too well. The paper addresses this limitation by reconstructing separate frequency components with interacting generator branches.
- Reconstruction-based methods: Sparse reconstruction assumes normal samples require few basis functions, whereas abnormal samples are more expensive to reconstruct.L1 norm-based kernel PCA and low-rank embedded networks are examples of this approach.
- Reconstruction-based methods: Autoencoders and GANs reconstruct samples from normal training data, with anomaly scores based on reconstruction error.Abnormal images are expected to produce higher errors because they differ in data distribution.
- Limitations: Strong generators make it challenging to preserve poor reconstruction for abnormal samples, causing weak performance in sensory detection.Existing methods also reconstruct all RGB frequencies indiscriminately, which can burden the generator.
- Proposed approach: OCR-GAN uses multiple generators to reconstruct omni-frequency images and trains them with a discriminator for anomaly detection.After training, abnormal images are expected to reconstruct poorly and receive higher anomaly scores.
- Proposed architecture: The architecture overview combines frequency-decoupled inputs, parallel reconstructions, summed outputs, and channel interaction among encoder branches.The CS module performs interaction across the frequency-specific encoders.
B. Frequency Decoupling
The Frequency Decoupling module represents images through multiple frequency bands because normal and abnormal content differs across frequencies. It produces frequency-specific inputs for parallel reconstruction branches.
- Motivation: Low-frequency components contain more semantic information, while high-frequency components contain more detailed texture information.Abnormal elements such as holes, cracks, and scratches create frequency-distribution differences between normal and abnormal images.
- FD construction: FD begins by convolving the input with Gaussian kernels and down-sampling blurred images to construct progressively smoothed representations.Upsampling and Gaussian filtering approximate missing pixels at each level.
- FD construction: Repeating the smoothing process yields blurred images with varying degrees of lost high-frequency information.The paper denotes the resulting set as {IG1, IG2, . . . , IGn}.
- Frequency components: FD obtains omni-frequency images by calculating differences between adjacent blurred images.These differences isolate frequency components for subsequent reconstruction.
- Architecture: The paper defaults to two frequency branches, with different components reconstructed by multiple independent generators.FD is intended for frequency-sensitive tasks such as anomaly detection.
C. Channel Selection
Channel Selection addresses the independence of frequency branches by exchanging information and adaptively reweighting channels. It uses pooled feature statistics to generate branch-specific attention during encoding.
- Motivation: CS is introduced because FD-only branches are relatively independent even though different frequencies complement each other.The module performs omni-frequency interaction and adaptive selection of channel features.
- Feature fusion: For high- and low-frequency feature maps, CS first fuses the branches through element-wise summation.The two feature maps share dimensions H × W × C.
- Channel descriptor: Global Average Pooling embeds the fused features into channel-wise statistics.The resulting vector z1 belongs to R^C.
- Adaptive selection: A fully connected layer reduces z1 from C dimensions to d dimensions to provide adaptive channel selection.The compact descriptor z2 is then used to regress branch-specific channel attentions.
- Feature reweighting: The attention vectors l and h reweight channels in the low- and high-frequency feature maps, producing augmented features.The vectors complement each other in the two-branch case, satisfying lc + hc = 1.
- Integration: CS is applied at every encoding stage, and its output becomes the input to the next layer of each frequency-specific encoder.The design extends to multiple branches by adding corresponding attention weights.
D. Training
OCR-GAN trains from scratch using only normal samples, while incorporating forged abnormal samples and multiple losses to improve reconstruction-based anomaly detection. Its training combines reconstruction, adversarial, and latent objectives.
- Training: OCR-GAN is trained end-to-end from scratch using only normal samples, then tested on both normal and abnormal samples.The method assumes abnormal pixels are poorly reconstructed because abnormal samples are absent from training.
- Training: CutPaste and CutOut augmentations generate forged abnormal data that, together with generated samples, serve as positive discriminator inputs.Original normal samples serve as negative discriminator inputs.
- Training: The adversarial loss trains the generator to produce realistic reconstructions while the discriminator distinguishes normal, reconstructed, and forged abnormal images.The generator minimizes this loss and the discriminator maximizes it.
- Training: Latent loss uses penultimate-layer discriminator features and penalizes the ℓ2 error between latent-space features.These features define the latent representation used by OCR-GAN.
- Training: The total objective is a weighted sum of reconstruction, adversarial, and latent losses, with λrec = 50, λadv = 1, and λlat = 1.These weights follow the baseline Skip-GANomaly settings and the authors’ experiments.
E. Inference
OCR-GAN detects anomalies from reconstruction and latent representation errors, combines these errors into an anomaly score, and scales scores across the test set. A threshold can then be selected for deployment requirements.
- Inference: Inference computes an anomaly score using the reconstruction-based procedure proposed in.The score is evaluated for each test image.
- Inference: The score combines image-content reconstruction error Lcon(I) with latent representation error Llat(I), using λ = 0.9.Lcon measures input–reconstruction content similarity, while Llat derives from latent loss.
- Inference: Scores for all test samples are collected in A and scaled to the range [0, 1] to produce final anomaly scores.The scaling follows.
- Inference: The anomaly-score threshold can be set according to requirements in real-world applications.
IV. EXPERIMENTS
The experiments evaluate OCR-GAN on both sensory and semantic anomaly-detection tasks using public datasets and comparisons with state-of-the-art methods. The paper primarily focuses on sensory anomaly detection.
- IV. EXPERIMENTS: OCR-GAN is evaluated in two anomaly-detection settings: sensory AD and semantic AD.The evaluations compare the method with state-of-the-art approaches on public datasets.
- IV. EXPERIMENTS: The paper focuses primarily on the sensory anomaly-detection task.
A. Experimental Setup
The setup evaluates OCR-GAN mainly on sensory anomaly detection using MVTec AD, DAGM, and KolektorSDD, with CIFAR-10 for semantic AD. Experiments use two frequency branches and Skip-GANomaly as the baseline, with AUC as the metric.
- Experimental Setup: MVTec AD, DAGM, and KolektorSDD are used for sensory anomaly detection, while CIFAR-10 evaluates semantic anomaly detection.MVTec AD contains 5,354 images across 10 object and 5 texture categories; CIFAR-10 uses one class as normal and the others as abnormal.
- Experimental Setup: MVTec AD images are downscaled to 256×256, with category training sets containing 60 to 320 samples and test anomalies spanning more than 70 defect types.
- Experimental Setup: Experiments use two frequency branches, Adam optimization, and Skip-GANomaly as the baseline.Batch sizes are 32 for MVTec AD and 64 for DAGM, KolektorSDD, and CIFAR-10.
- Experimental Setup: AUC is the evaluation metric, with higher AUC indicating better anomaly-detection performance.AUC is computed from the ROC curve by gradually changing the anomaly-score threshold.
- Experimental Setup: Ablation and interpretability experiments are conducted on MVTec AD, using two frequency branches to limit parameter count and computational cost.OCR-GAN retains the baseline parameter settings unless otherwise specified.
B. Compare with SOTA Methods
OCR-GAN is evaluated against unsupervised anomaly-detection methods across sensory and semantic datasets. It achieves strong overall results without extra training data, including state-of-the-art performance on MVTec AD.
- 98.3 detection AUC establishes OCR-GAN as a new state of the art on MVTec AD without extra training data.
- +18.3 AUC over DGAD, +3.6 over DifferNet, and +1.2 over CutPaste quantify OCR-GAN’s gains over reconstruction-, density-, and classification-based methods.
- +0.3 AUC over Draem is achieved without extra training data, despite Draem using reconstruction and anomaly-segmentation models trained with extra data.
- 99.3 detection AUC on DAGM is comparable to supervised methods, while 91.4 detection AUC is achieved on KolektorSDD without extra training data.
- On CIFAR-10 semantic anomaly detection, OCR-GAN improves performance by +16.3 over the skip-GANomaly baseline in Setting2.
C. Ablation Study
Ablations attribute OCR-GAN’s gains mainly to its Frequency Decoupling and Channel Selection modules. The model also benefits from additional frequency branches, while channel reduction can improve performance under a lightweight setting.
- λcon and anomaly-score weighting are separately varied in the hyperparameter ablations shown in Fig. 7.
- +22.1 AUC from adding CS after FD raises the baseline to 96.9 AUC, while FD alone contributes +14.6 AUC.
- +8.3 AUC results from training the baseline with forgery abnormal images, whereas FD and CS provide the main improvements.
- +0.6 AUC from three frequency branches indicates that additional frequencies contribute to performance, although two branches balance effectiveness and efficiency.
- High-frequency-only reconstruction outperforms low-frequency-only reconstruction, while independent frequency branches lack information interaction that CS addresses.
- 98.7 AUC is obtained with four generator feature channels, exceeding the standard 64-channel configuration in the lightweight experiment.
D. Interpretability of OCR-GAN
Interpretability analyses examine anomaly-score separation and reconstruction differences. OCR-GAN produces clearer normal–abnormal score separation and more detailed reconstructions than classical reconstruction-based methods.
- Normal samples receive lower anomaly scores and abnormal samples higher scores, with clear separation across MVTec AD categories.
- The t-SNE visualization covers normal and abnormal samples across eight MVTec AD categories.
- Reducing generator channels first improves and then degrades AUC, revealing a non-monotonic capacity–performance relationship.
- OCR-GAN reconstructs details better, making abnormal regions more prominent in difference images than in other classical reconstruction-based methods.