Abstract:
Industrial image anomaly detection is significant for ensuring product quality, especially in scenarios where anomaly samples are scarce. Existing unsupervised methods face challenges in feature adaptation and complex pattern modeling. To address this, this paper proposes an anomaly detection method based on feature adaptation and centroid-guided contrastive learning. The method first utilizes a lightweight feature adaptation module to mitigate the domain shift problem of pre-trained models. Then, a centroid-guided contrastive learning mechanism is introduced, which uses initialized centroids to dynamically model feature point relationships and optimizes the feature space distribution by constructing centroid-based positive and negative sample pairs to enhance the model's discriminative ability. Finally, an adaptive centroid selection strategy is designed to adaptively choose a scoring mechanism based on the certainty of feature point assignment, improving detection accuracy in ambiguous boundary regions. Experiments show that the method achieves an image-level AUROC of 99.4% and a pixel-level AUROC of 98.3% on the MVTec dataset, validating its effectiveness in industrial anomaly detection and localization tasks.