Do We Really Need to Learn Representations from In-domain Data for Outlier Detection?

Zhisheng Xiao, Qing Yan, Yali AmitarXiv 2021

Abstract

Unsupervised outlier detection typically involves training a feature extractor on task-specific in-domain data. This paper challenges this paradigm, proposing a "universal" feature extractor pre-trained on ImageNet using self-supervised learning. The authors demonstrate that this approach not only simplifies the detection pipeline but also achieves performance superior to models trained specifically on target data. By modeling in-domain features as a Gaussian Mixture and using Mahalanobis distance for scoring, the proposed method sets new benchmarks across various Out-of-Distribution (OOD) and anomaly detection tasks.

Introduction

Deep learning models are notoriously brittle when encountering Out-of-Distribution (OOD) samples. Unsupervised outlier detection aims to identify these anomalies using only unlabeled "inlier" data. The prevailing state-of-the-art approach follows a two-stage framework: first, learning a high-quality representation from the in-domain data via self-supervised learning (SSL), and second, applying a statistical detector in that feature space. However, training task-specific extractors is computationally intensive and requires significant tuning. This research asks: can a generic, pre-trained model provide high-performance outlier detection "for free"?

Methodology

The authors propose a simplified pipeline using a universal feature extractor. They utilize a ResNet-50 architecture pre-trained on ImageNet. A key finding is the superiority of self-supervised pre-training (e.g., SimCLR, MoCo) over standard supervised classification pre-training for this purpose.

For the detection stage, in-domain features are partitioned into $M$ clusters using K-means and modeled as a Gaussian Mixture. The outlier score is defined as the minimum Mahalanobis distance to these cluster centers. To prevent overfitting, especially with limited in-domain samples, a tied covariance matrix is shared across all clusters. Additionally, small input perturbations are applied during testing to enhance the separation between inliers and outliers.

Key Insights: The Power of Self-Supervision

A central insight of this work is that self-supervised features are significantly more effective for OOD detection than supervised ones. While supervised models focus on features relevant to specific labels, self-supervised models develop a broader semantic understanding of the visual world. This "richer" representation allows the model to generalize to entirely different domains (e.g., using ImageNet features to detect outliers in CIFAR-10).

Performance comparison across different self-supervised pre-training algorithms.

As shown in the table above, while SimCLRv2 generally provides the best AUROC, the performance remains robust across various modern SSL algorithms, confirming the general utility of self-supervised representations.

Experimental Results

The proposed method was evaluated across low-resolution OOD (CIFAR-10), high-resolution OOD (ImageNet-30, CUB, etc.), and one-class anomaly detection benchmarks.

Comparison of outlier detection performance (AUROC) across various datasets and methods.

On CIFAR-10 OOD tasks, the method achieved an average AUROC of 92.6%, outperforming previous state-of-the-art methods like CSI, which require expensive task-specific training. In high-resolution scenarios, the universal extractor often achieved near-perfect AUROCs (above 98%). These results suggest that the "cost of entry" for implementing robust outlier detection can be drastically reduced by using pre-trained universal models.

Conclusion

This study demonstrates that task-specific representation learning is often unnecessary for effective outlier detection. A universal feature extractor pre-trained via self-supervision on a large, diverse dataset like ImageNet provides a powerful and efficient alternative. While currently focused on the image domain, this paradigm shift suggests that as SSL matures in other modalities, "plug-and-play" outlier detection could become a standard component of robust AI systems.

Summary updated

BibTeX
@misc{xiao2021do,
  author = {Zhisheng Xiao and Qing Yan and Yali Amit},
  title = {{Do We Really Need to Learn Representations from In-domain Data for Outlier Detection?}},
  year = {2021},
  eprint = {2105.09270},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.09270},
}
Figure