ReContrast: Domain-Specific Anomaly Detection via Contrastive Reconstruction

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.

Paper

Similar papers

Peer review

Reviewer S3Cv6/10 · confidence 4/52023-06-20

Summary

The paper presents an approach, called ReContrast, for domain-specific anomaly detection and segmentation. The authors aim to overcome the transfer limitations of existing methods by addressing and mitigating the challenges associated with the use of pre-trained encoders from natural image domains. They propose a combination of the reverse distillation approach and contrastive learning to optimize the entire network and align it with the target domain. In the paper, the authors systematically explain their approach, highlighting three key elements: the introduction of a new optimization objective called global cosine distance to enhance training stability, the utilization of stop-gradient operation to prevent pattern collapse, and the integration of contrastive learning (without the use of negative samples). By integrating these elements into their feature reconstruction framework, the authors improve the network's transfer ability for anomaly detection tasks.

Strengths

1. The authors address and analyze the limitations of the reverse distillation approach by incorporating simple yet effective modifications. This results in an improved anomaly detection method. 2. The paper is well-written, and provides a clear and concise description of the proposed ReContrast framework and its underlying principles. 3. The experimental evaluations conducted across diverse datasets and models demonstrate the practicality and effectiveness of the approach.

Weaknesses

1. The authors handle training instability by selectively changing the batch normalization (BN) mode of the encoder based on performance on specific datasets or categories. This raises concerns about the proposed method's reliability and generalizability. Using the test set to modify the training process of problematic categories can introduce unintended biases and compromise the evaluation integrity. It would be more desirable to provide a systematic and principled approach to utilizing BN layers without relying on a separate validation set. This would ensure consistent and unbiased training across all datasets and categories. Consequently, it is important to report the performance of the proposed approach when utilizing the train and eval modes consistently for all datasets. Such analysis would provide valuable insights into the observed performance drops that the authors mentioned and help assess the robustness of the proposed method. 2. Another limitation of the paper is the narrow focus on structural anomalies, as evidenced by the results presented in Table A6. While the proposed method performs well at detecting structural anomalies, it falls short when it comes to detecting logical anomalies. It is important to highlight this limitation in the main paper since unsupervised anomaly detection encompasses various anomaly types, including global anomalies like those found in datasets such as CIFAR-10 ([24-26] in the appendix). Clarifying the scope and limitations of the method for detecting different anomaly types will provide a more comprehensive understanding of its applicability in real-world scenarios. \#### Update #### \ I've increased my rating slightly in light of the response.

Questions

The paper lacks of reported results in the multi-class setting, where anomaly detection is performed across multiple target classes simultaneously. This setting ([9] in the manuscript), reflects a more realistic scenario of anomaly detection in real-world applications. By learning the data distribution of multiple classes jointly, the detection task becomes more complex and challenging. However, the paper does not provide insights into the performance of the proposed ReContrast approach in this specific setting. What is the performance of the proposed ReContrast approach in this setting? I am willing to improve my score once these points (including weaknesses) are clarified.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

3 good

Contribution

2 fair

Limitations

Yes.

Reviewer e2Vq4/10 · confidence 5/52023-06-23

Summary

This paper proposes an epistemic method, namely ReContrast, for unsupervised anomaly detection (UAD). The proposed method is deeply based on UniAD and RD4AD, with some technical improvement to adapt to the data from different domains. Experiments are conducted on two popular industrial defect detection benchmarks and three medical image UAD tasks.

Strengths

1. The technical details are well illustrated in the paper. 2. Ablation studies show the effectiveness of the proposed components.

Weaknesses

1. The paper lacks novelty and resembles more of a technical report than a research paper. The authors summarize their contributions in Lines 68-78, which primarily consist of detailed technical modifications. The proposed method heavily relies on existing methods UniAD and RD4AD, with some specific improvements such as generating contrastive pairs and utilizing a GAP-mimicking objective function. 2. This paper has room for improvement in terms of its writing. In Lines 42-59, the authors introduce several components aimed at enhancing performance. However, the relationships between these components are not clearly established, and the motivations behind their inclusion are not adequately explained.

Questions

1. Unclear contributions compared to existing methods: The paper does not clearly differentiate its contributions from those of existing methods. Both feature reconstruction [9] and contrastive learning [a,b] have been extensively explored in the anomaly detection literature. Although the authors mention the usage of stop-gradient as their main contribution (Lines 75-76), it has already been employed in [a,b]. 2. Missing important experimental comparisons: While this paper heavily relies on UniAD [9], it fails to provide any comparisons with UniAD in Table 1, Table 2, and Table 3. Including such comparisons would be crucial for evaluating the proposed method against the baseline. 3. Poor organization: The organization of Section 2.2-2.6 is confusing and lacks coherence. These subsections appear to be assembled randomly without a clear structure, and there is no apparent connection between them. It seems that existing methods and the authors' proposed methods are randomly mixed together, leading to a lack of clarity and logical flow. 4. Domain-specific claims and evaluation: The authors assert that their method is domain-specific, claiming that the proposed components could help adapt the model to industrial or medical domains. However, it is unclear whether the trained model can be used simultaneously on both industrial datasets, i.e, MVTec and Visa. The authors should clarify why they separately evaluate these datasets. They are suggested to follow the approach of UniAD [9] to demonstrate if one model can effectively detect anomalies across multiple categories within a single dataset. References: [a] Focus your distribution: Coarse-to-fine non-contrastive learning for anomaly detection and localization. ICME 2022. [b] Registration-based Few-Shot Anomaly Detection. ECCV 2022.

Rating

4: Borderline reject: Technically solid paper where reasons to reject, e.g., limited evaluation, outweigh reasons to accept, e.g., good evaluation. Please use sparingly.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

2 fair

Contribution

2 fair

Limitations

N/A

Reviewer xS4v7/10 · confidence 5/52023-07-01

Summary

This paper proposes a novel unsupervised anomaly detection (UAD) method called ReContrast. The method addresses the issue of poor transferability of pre-trained encoders from natural image domains to target UAD domains such as industrial inspection and medical imaging. ReContrast optimizes the entire network to reduce biases towards the pre-trained image domain and aligns the network with the target domain. It combines feature reconstruction and contrastive learning to prevent training instability and pattern collapse. The method is evaluated on industrial defect detection benchmarks and medical image UAD tasks, demonstrating its superiority over current state-of-the-art methods.

Strengths

1. The paper is well-written and easy to read. 2. This paper propose a new unsupervised anomaly detection method, ReContrast. According to the suggested setup, it is technically valid and should work well. 3. Sufficient experiments are done to demonstrate the effectiveness of the method, and the robustness of the method is proved by experiments on multiple data sets 4. The results were strong. Performance is excellent in most cases.

Weaknesses

1. In the ablation experiments of MVTec AD and APTOS, for example, the experiment on Global Cosine Similarity, the author conducted experiments on the original RD4AD, namely Config A and Config B. This is not sufficient to prove the validity of Global Cosine Similarity on ReContrast, and may be a special case on RD4AD Settings. 2. The realistic contribution of this paper is relatively weak. Compared with other methods, the reconstructed method does not rely on the pre-trained model or the memory library in anomaly detection. The method in this paper relies on the pre-trained model to maintain the feature extraction capability of the encoder, which I think may affect the practical application of the model.

Questions

I really appreciate the structure of this article. The author has done a lot of work in the demonstration experiment, but the method innovation and contribution are relatively limited, but the overall is worth learning. Here are some suggestions. 1.Regarding the experiment of Global Cosine Similarity, the author conducted the experiment on the original RD4AD, namely Config A and Config B. It is suggested to add the experimental setting using Region Cosine Similarity to the experimental setting of Config E. To demonstrate the validity of Global Cosine Similarity on ReContrast, rather than a special case on RD4AD Settings. 2.In the experimental part, I noticed that the P-AUROC/AUPRO index lacked two model indexes compared with I-AUROC, ADTR and CFlow AD, in the experiment conducted on MVTec AD dataset. I hope the author could provide completion to ensure the completeness of the experiment. 3.It is hoped that the author can visualize how the model gets the Anomaly score map in the visual RD4AD in Figure 2 to ReContrast, so as to facilitate readers' understanding.

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

Limitations are clearly described and I don't expect negative societal impact of this work.

Reviewer dCnY7/10 · confidence 5/52023-07-05

Summary

This work proposes an unsupervised anomaly detection method using contrastive learning method to reduce the biases between the pre-trained image domain and the target domain. In the paper, different designs of reconstruction networks are introduced and compared in terms of detection performance, model coverage and feature diversity. Finally, authors adopt a contrastive learning method equipped with global cosine loss, hard example mining, as well as additional frozen pre-trained encoder branch. This work conducts extensive experiments across two industrial defect detection benchmarks and three medical image anomaly detection tasks to demonstrate the transfer ability on various image domains.

Strengths

+ This work analyzes the domain gap between the pretrained image domain and the dataset image domain and tries a variety of modifications on distillation network to reduce the domain gap. + Extensive experiments are conducted on MVTec AD, VisA, and three medical image datasets to demonstrate the transfer ability on various image domains.

Weaknesses

- During both training and inference, the feature loss is calculated using six feature pairs from two encoders. The utilization of two encoders in the methods leads to an increase in parameters and inference time. However, this approach functions as an ensemble, contributing to improved performance. It is important to note that the ablation study does not provide results solely generated by the domain-specific encoder. - The training process for configuration E lacks explicit description in the text. In accordance with the information provided in Figure 2, the encoders are switched and repeated during training. However, the text does not provide a detailed explanation of this process. - Figure 4 displays the landscapes of S_map, which allows for a comparison between the two losses. According to the description, S_map represents the average anomaly score map of the APTOS dataset. However, the paper or reference [27] does not provide an introduction on how to interpret or visualize the figures, nor does it explain why average anomaly score maps from different images are used, considering that they may have different anomaly locations.

Questions

- As the work follows the SimSiam’s stop-gradient operation to prevent model collapsing. How about using momentum encoder in Moco to train the domain-specific encoder? - In this framework, the encoder must be switched during training, why not merge the features from flexible encoder and frozen encoder and then fed to the neck and decoder? In this way a unified network can be achieved.

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

2 fair

Presentation

3 good

Contribution

2 fair

Limitations

Authors have addressed limitations of the method on training instability and logical anomaly detection.

Reviewer Jpdb4/10 · confidence 5/52023-07-11

Summary

This paper introduces a feature reconstruction model, namely ReContrast, for anomaly detection. By incorporating a set of techniques including feature global similarity, stop gradient, contrastive pair optimizations, the authors shows good performance of ReContrast on both industrial and medical datasets.

Strengths

1. The paper is easy to follow. The logic behind some technical improvements is well motivated. 2. Extensive experimentation on diverse anomaly detection datasets is conducted. The numerical results of ReContrast outperforms prior arts. 3. The analysis of limitation of RD4AD, especially the Global Cosine Similarity, is impressive.

Weaknesses

1. The paper presentation should be improved. The current version is in a lab report format, outlining the observed issues and employing trial-and-error strategies to address them. It would be preferable to present the methodology in a more cohesive manner. 2. I find it unclear why Config. D would prevent model collapse. As the feature similarity loss can be back-propagated from the decoder to the encoder, the encoder and decoder may collaborate to achieve a trivial solution. 3. The motivation behind Config. E is also unclear to me. If the decoder's objective is to reconstruct the pre-trained encoder, what is the purpose of the trainable encoder? What is the objective function in Config. E? 4. Figure 4 illustrates the model landscape with respect to model's trainable parameters. A flatter surface indicates a more stable training process, but it does not necessarily indicate better generalization concerning input data.

Questions

Please refer to question 2-4 in the weakness section.

Rating

4: Borderline reject: Technically solid paper where reasons to reject, e.g., limited evaluation, outweigh reasons to accept, e.g., good evaluation. Please use sparingly.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

3 good

Contribution

2 fair

Limitations

The appendix discuses the limitations of this method.

Reviewer xS4v2023-08-17

I appreciate the authors for their responses to my concerns. In summary, I will raise my score from weak accept to accept, in expectation of your inclusion of some discussion in the final version

Reviewer e2Vq2023-08-17

Thank you for your reply. I have carefully read the rebuttal and other reviews. As the authors have addressed part of my concerns, I have slightly increased my score.

Reviewer Jpdb2023-08-19

Thanks for the feedback from the authors.

The authors answered most of my questions. But I am still concerning the landscape figure. So I am keeping my original score.

Authorsrebuttal2023-08-21

On the connection between loss landscape and generalization

Thank you for your comments. The connection between the geometry of the loss landscape —— in particular, the flatness of minima —— and generalization has been studied from theoretical, empirical, and practical perspectives [a,b,c,d,e]. A direct and intuitive explanation is given as followed. Because of the distribution deviation between train samples and unseen test samples, flat and wide minimum on training samples can wrap the minimum of test samples, while sharper minimum on training samples will differ more from the minimum of test samples which causes higher test loss. Please see Figure 1 of [a] for a clearer illustration, as we cannot upload figure here. [a] Keskar, N.S., Mudigere, D., Nocedal, J., Smelyanskiy, M. and Tang, P.T.P., 2016, November. On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima. In International Conference on Learning Representations. [b] Dziugaite, G.K. and Roy, D.M., 2017. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008. [c] Jiang, Y., Neyshabur, B., Mobahi, H., Krishnan, D. and Bengio, S., 2020. Fantastic generalization measures and where to find them. In International Conference on Learning Representations. [d] Zhuang, J., Gong, B., Yuan, L., Cui, Y., Adam, H., Dvornek, N.C., s Duncan, J. and Liu, T., 2021, October. Surrogate Gap Minimization Improves Sharpness-Aware Training. In International Conference on Learning Representations. [e] Foret, P., Kleiner, A., Mobahi, H. and Neyshabur, B., 2020, October. Sharpness-aware Minimization for Efficiently Improving Generalization. In International Conference on Learning Representations.

Reviewer dCnY2023-08-20

Thank you for authors' reply. The rebuttal addressed most of my concerns. I slightly increased my score.

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC