Table of Contents
Fetching ...

CADet: Fully Self-Supervised Out-Of-Distribution Detection With Contrastive Learning

Charles Guille-Escuret, Pau Rodriguez, David Vazquez, Ioannis Mitliagkas, Joao Monteiro

TL;DR

The paper addresses the challenge of out-of-distribution detection by proposing a fully self-supervised approach that handles both unseen classes and adversarial perturbations. It combines a contrastive learning objective (based on SimCLRv2) with a maximum mean discrepancy (MMD) framework to test distributional shifts and introduces CADet, a single-sample anomaly detector that uses intra- and cross-sample contrastive similarities with a calibration mechanism. CADet demonstrates strong adversarial detection, competitive label-based OOD performance, and scalability advantages when using a self-supervised backbone, while the MMD-CC variant shows robust distribution shift testing with limited samples. The work highlights the complementary roles of in-sample and out-sample similarities for robust OOD and adversarial detection and provides practical, self-supervised tools for real-world deployment where labeled OOD data are unavailable. Overall, it offers a flexible, label-free framework that advances safe deployment of vision models in the presence of novel or manipulated inputs.

Abstract

Handling out-of-distribution (OOD) samples has become a major stake in the real-world deployment of machine learning systems. This work explores the use of self-supervised contrastive learning to the simultaneous detection of two types of OOD samples: unseen classes and adversarial perturbations. First, we pair self-supervised contrastive learning with the maximum mean discrepancy (MMD) two-sample test. This approach enables us to robustly test whether two independent sets of samples originate from the same distribution, and we demonstrate its effectiveness by discriminating between CIFAR-10 and CIFAR-10.1 with higher confidence than previous work. Motivated by this success, we introduce CADet (Contrastive Anomaly Detection), a novel method for OOD detection of single samples. CADet draws inspiration from MMD, but leverages the similarity between contrastive transformations of a same sample. CADet outperforms existing adversarial detection methods in identifying adversarially perturbed samples on ImageNet and achieves comparable performance to unseen label detection methods on two challenging benchmarks: ImageNet-O and iNaturalist. Significantly, CADet is fully self-supervised and requires neither labels for in-distribution samples nor access to OOD examples.

CADet: Fully Self-Supervised Out-Of-Distribution Detection With Contrastive Learning

TL;DR

The paper addresses the challenge of out-of-distribution detection by proposing a fully self-supervised approach that handles both unseen classes and adversarial perturbations. It combines a contrastive learning objective (based on SimCLRv2) with a maximum mean discrepancy (MMD) framework to test distributional shifts and introduces CADet, a single-sample anomaly detector that uses intra- and cross-sample contrastive similarities with a calibration mechanism. CADet demonstrates strong adversarial detection, competitive label-based OOD performance, and scalability advantages when using a self-supervised backbone, while the MMD-CC variant shows robust distribution shift testing with limited samples. The work highlights the complementary roles of in-sample and out-sample similarities for robust OOD and adversarial detection and provides practical, self-supervised tools for real-world deployment where labeled OOD data are unavailable. Overall, it offers a flexible, label-free framework that advances safe deployment of vision models in the presence of novel or manipulated inputs.

Abstract

Handling out-of-distribution (OOD) samples has become a major stake in the real-world deployment of machine learning systems. This work explores the use of self-supervised contrastive learning to the simultaneous detection of two types of OOD samples: unseen classes and adversarial perturbations. First, we pair self-supervised contrastive learning with the maximum mean discrepancy (MMD) two-sample test. This approach enables us to robustly test whether two independent sets of samples originate from the same distribution, and we demonstrate its effectiveness by discriminating between CIFAR-10 and CIFAR-10.1 with higher confidence than previous work. Motivated by this success, we introduce CADet (Contrastive Anomaly Detection), a novel method for OOD detection of single samples. CADet draws inspiration from MMD, but leverages the similarity between contrastive transformations of a same sample. CADet outperforms existing adversarial detection methods in identifying adversarially perturbed samples on ImageNet and achieves comparable performance to unseen label detection methods on two challenging benchmarks: ImageNet-O and iNaturalist. Significantly, CADet is fully self-supervised and requires neither labels for in-distribution samples nor access to OOD examples.
Paper Structure (19 sections, 10 equations, 2 figures, 6 tables, 3 algorithms)

This paper contains 19 sections, 10 equations, 2 figures, 6 tables, 3 algorithms.

Figures (2)

  • Figure 1: AUROC score of CADet against the number of transformations.
  • Figure :

Theorems & Definitions (1)

  • Definition 4.1: gretton2012kernel