# Contrastive Predictive Coding for Anomaly Detection

Preprint · Puck de Haan, Sindy Löwe

- Archive id: arxiv:2107.07820
- Published: 2021-07-16
- arXiv: https://arxiv.org/abs/2107.07820
- Citations: 13
- Source URL: https://arxiv.org/abs/2107.07820
- PDF: https://arxiv.org/pdf/2107.07820
- Provenance: arxiv

## Abstract

Reliable detection of anomalies is crucial when deploying machine learning models in practice, but remains challenging due to the lack of labeled data. To tackle this challenge, contrastive learning approaches are becoming increasingly popular, given the impressive results they have achieved in self-supervised representation learning settings. However, while most existing contrastive anomaly detection and segmentation approaches have been applied to images, none of them can use the contrastive losses directly for both anomaly detection and segmentation. In this paper, we close this gap by making use of the Contrastive Predictive Coding model (arXiv:1807.03748). We show that its patch-wise contrastive loss can directly be interpreted as an anomaly score, and how this allows for the creation of anomaly segmentation masks. The resulting model achieves promising results for both anomaly detection and segmentation on the challenging MVTec-AD dataset.

_Abstract reproduced under CC0-1.0 (arXiv descriptive metadata)._

Topics: [NeuroAI & Computational Neuroscience](https://space-kitty.com/topics/neuroai)

---
Space Kitty Archive · https://space-kitty.com · API: https://space-kitty.com/api/v1 · MCP: https://space-kitty.com/mcp · Premium: $0.20/request via x402 (Base Sepolia (testnet)). Metadata: arXiv (CC0), OpenAlex (CC0), Europe PMC (CC BY/CC0 works), ClinicalTrials.gov.
