TasksSotADatasetsPapersMethodsSubmitAbout
Papers With Code 2

A community resource for machine learning research: papers, code, benchmarks, and state-of-the-art results.

Explore

Notable BenchmarksAll SotADatasetsPapersMethods

Community

Submit ResultsAbout

Data sourced from the PWC Archive (CC-BY-SA 4.0). Built by the community, for the community.

Papers/Mean-Shifted Contrastive Loss for Anomaly Detection

Mean-Shifted Contrastive Loss for Anomaly Detection

Tal Reiss, Yedid Hoshen

2021-06-07Representation LearningSelf-Supervised LearningAnomaly DetectionContrastive Learning
PaperPDFCodeCode(official)

Abstract

Deep anomaly detection methods learn representations that separate between normal and anomalous images. Although self-supervised representation learning is commonly used, small dataset sizes limit its effectiveness. It was previously shown that utilizing external, generic datasets (e.g. ImageNet classification) can significantly improve anomaly detection performance. One approach is outlier exposure, which fails when the external datasets do not resemble the anomalies. We take the approach of transferring representations pre-trained on external datasets for anomaly detection. Anomaly detection performance can be significantly improved by fine-tuning the pre-trained representations on the normal training images. In this paper, we first demonstrate and analyze that contrastive learning, the most popular self-supervised learning paradigm cannot be naively applied to pre-trained features. The reason is that pre-trained feature initialization causes poor conditioning for standard contrastive objectives, resulting in bad optimization dynamics. Based on our analysis, we provide a modified contrastive objective, the Mean-Shifted Contrastive Loss. Our method is highly effective and achieves a new state-of-the-art anomaly detection performance including $98.6\%$ ROC-AUC on the CIFAR-10 dataset.

Results

TaskDatasetMetricValueModel
Anomaly DetectionAnomaly Detection on Unlabeled CIFAR-10 vs LSUN (Fix)ROC-AUC92.6MeanShifted
Anomaly DetectionUnlabeled CIFAR-10 vs CIFAR-100AUROC90MeanShifted
Anomaly DetectionOne-class CIFAR-100AUROC96.5Mean-Shifted Contrastive Loss
Anomaly DetectionOne-class CIFAR-10AUROC98.6Mean-Shifted Contrastive Loss
Anomaly DetectionMVTec ADDetection AUROC87.2Mean-Shifted Contrastive Loss

Related Papers

Multi-Stage Prompt Inference Attacks on Enterprise LLM Systems2025-07-21Touch in the Wild: Learning Fine-Grained Manipulation with a Portable Visuo-Tactile Gripper2025-07-20Spectral Bellman Method: Unifying Representation and Exploration in RL2025-07-17Boosting Team Modeling through Tempo-Relational Representation Learning2025-07-17A Semi-Supervised Learning Method for the Identification of Bad Exposures in Large Imaging Surveys2025-07-173DKeyAD: High-Resolution 3D Point Cloud Anomaly Detection via Keypoint-Guided Point Clustering2025-07-17SemCSE: Semantic Contrastive Sentence Embeddings Using LLM-Generated Summaries For Scientific Abstracts2025-07-17HapticCap: A Multimodal Dataset and Task for Understanding User Experience of Vibration Haptic Signals2025-07-17