Skip to main content
QUICK REVIEW

[Paper Review] ReContrast: Domain-Specific Anomaly Detection via Contrastive Reconstruction

Jia Guo, Shuai Lu|arXiv (Cornell University)|Jun 5, 2023
Anomaly Detection Techniques and ApplicationsComputer Science14 citations
TL;DR

ReContrast jointly optimizes encoder and decoder for domain-specific anomaly detection by embedding contrastive learning elements into feature reconstruction, improving transfer from pre-trained natural-image encoders to industrial and medical UAD tasks.

ABSTRACT

Most advanced unsupervised anomaly detection (UAD) methods rely on modeling feature representations of frozen encoder networks pre-trained on large-scale datasets, e.g. ImageNet. However, the features extracted from the encoders that are borrowed from natural image domains coincide little with the features required in the target UAD domain, such as industrial inspection and medical imaging. In this paper, we propose a novel epistemic UAD method, namely ReContrast, which optimizes the entire network to reduce biases towards the pre-trained image domain and orients the network in the target domain. We start with a feature reconstruction approach that detects anomalies from errors. Essentially, the elements of contrastive learning are elegantly embedded in feature reconstruction to prevent the network from training instability, pattern collapse, and identical shortcut, while simultaneously optimizing both the encoder and decoder on the target domain. To demonstrate our transfer ability on various image domains, we conduct extensive experiments across two popular industrial defect detection benchmarks and three medical image UAD tasks, which shows our superiority over current state-of-the-art methods.

Motivation & Objective

  • Address poor transferability of frozen ImageNet encoders to target UAD domains (industrial/medical).
  • Propose end-to-end training of both encoder and decoder with contrastive reconstruction to reduce biases toward natural images.
  • Integrate contrastive-learning elements (global cosine distance, stop-gradient, two-view representations) into feature reconstruction.
  • Mitigate training instability and pattern collapse through hard-mining and augmentation-free contrastive pairs.
  • Demonstrate superior performance across industrial and medical UAD benchmarks.

Proposed method

  • Start from a feature reconstruction baseline (RD4AD) and integrate three contrastive-learning inspired elements into training.
  • Introduce a global cosine distance objective to mimic GAP while maintaining point-wise correspondence.
  • Apply stop-gradient in the global cosine loss to prevent feature-map level collapse.
  • Create two-view representations without image augmentations using a domain-adapted encoder and a frozen encoder to form cross-view reconstruction.
  • Add a hard-mining strategy (L_global-hm) to focus training on hard-normal regions and widen epistemic vs intrinsic errors.
  • Demonstrate end-to-end optimization of both encoder and decoder to adapt to target domains while avoiding trivial solutions.
Figure 1: Comparison of architectures. (a) Contrastive learning [ 16 ; 17 ] . (b) Feature reconstruction UAD [ 2 ; 9 ] . (c) Proposed ReContrast. Two decoders share the same weights. z is the output of encoder. q is the output of predictor or decoder. z’ and q’ is another view of z and q, respective
Figure 1: Comparison of architectures. (a) Contrastive learning [ 16 ; 17 ] . (b) Feature reconstruction UAD [ 2 ; 9 ] . (c) Proposed ReContrast. Two decoders share the same weights. z is the output of encoder. q is the output of predictor or decoder. z’ and q’ is another view of z and q, respective

Experimental results

Research questions

  • RQ1Can end-to-end optimization of both encoder and decoder overcome the domain gap between pre-trained natural-image features and target UAD domains?
  • RQ2How do global vs. regional cosine distance objectives affect training stability and anomaly detection performance?
  • RQ3Does incorporating stop-gradient and augmentation-free contrastive pairs prevent pattern collapse and improve transferability?
  • RQ4Does hard-normal mining improve separation between epistemic and intrinsic reconstruction errors in UAD?

Key findings

  • Achieves high image-level AUROC on industrial UAD: 99.5% I-AUROC on MVTec AD, reducing previous best error by about half (to 0.5% relative).
  • Attains state-of-the-art anomaly segmentation on MVTec AD with P-AUROC and AUPRO metrics (AUPRO 95.2%).
  • On VisA, reaches I-AUROC 97.5% (outperforming SOTA by 1.5%) and AUPRO 92.6% (outperforming PatchCore by 1.3–1.4%).
  • Unified multi-class setting yields I-AUROC 98.2% on MVTec AD (vs. 96.5% UniAD) and 95.1% on VisA (vs. 91.5% UniAD with RD4AD baseline).
  • Medical image results show best or competitive performance across APTOS, OCT2017, and ISIC2018 datasets, demonstrating cross-domain adaptability.
Figure 2: From RD4AD to ReContrast. (a) Training configurations. (b) Calculation of anomaly map. The calculation and optimization of regional and global cosine distance is presented in Figure 3 .
Figure 2: From RD4AD to ReContrast. (a) Training configurations. (b) Calculation of anomaly map. The calculation and optimization of regional and global cosine distance is presented in Figure 3 .

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.