Papers › Mean-Shifted Contrastive Loss for Anomaly Detection

Mean-Shifted Contrastive Loss for Anomaly Detection

7 Jun 2021arXiv:2106.03844archive 2025-07-28

Tal Reiss, Yedid Hoshen

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.

PaperPDFConference PDFCode

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

Code

talreiss/Mean-Shifted-Anomaly-Detection officialmentioned in papermentioned on GitHubpytorchNOASSERTION report
talreiss/PANDA mentioned on GitHubpytorchNOASSERTION report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Anomaly DetectionContrastive LearningRepresentation LearningSelf-Supervised Learning

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Anomaly Detection Anomaly Detection on Unlabeled CIFAR-10 vs LSUN (Fix) MeanShifted Network ResNet-152 #5 of 8 Archive leaderboard report
Anomaly Detection Anomaly Detection on Unlabeled CIFAR-10 vs LSUN (Fix) MeanShifted ROC-AUC 92.6 #5 of 8 Archive leaderboard report
Anomaly Detection MVTec AD Mean-Shifted Contrastive Loss Detection AUROC 87.2 #117 of 148 Archive leaderboard report
Anomaly Detection One-class CIFAR-10 Mean-Shifted Contrastive Loss AUROC 98.6 #6 of 36 Archive leaderboard report
Anomaly Detection One-class CIFAR-100 Mean-Shifted Contrastive Loss AUROC 96.5 #4 of 15 Archive leaderboard report
Anomaly Detection Unlabeled CIFAR-10 vs CIFAR-100 MeanShifted AUROC 90.0 #5 of 13 Archive leaderboard report
Anomaly Detection Unlabeled CIFAR-10 vs CIFAR-100 MeanShifted Network ResNet-152 #5 of 13 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections