Unsupervised Outlier Detection using Memory and Contrastive Learning

Ning Huyan, Dou Quan, Xiangrong Zhang, Xuefeng Liang, Jocelyn Chanussot, Licheng Jiao · DOI

Introduction

Unsupervised outlier detection (OD) aims to identify anomalous samples in a dataset without the guidance of labels. Traditionally, Autoencoders (AEs) have been the standard tool for this task, operating on the assumption that anomalies are harder to reconstruct than normal data. However, modern neural networks are often excessively proficient at reconstruction, frequently reproducing outliers with high fidelity. This "over-reconstruction" prevents AEs from effectively distinguishing between inliers and outliers based on pixel-level errors.

The MCOD Framework

To address these limitations, we introduce MCOD (Memory and Contrastive Learning for Outlier Detection). MCOD shifts the focus from pixel-level reconstruction to high-level feature space analysis. The framework utilizes two primary components: a Contrastive Learning Module and a specialized Memory Module.

The MCOD architecture combines contrastive learning with a memory module featuring reading, writing, and forgetting operations.

Contrastive Learning Module

Using a dual-encoder setup (similar to MoCo), the model learns to map augmented versions of the same image to similar feature representations while pushing different images apart. This process establishes a discriminative feature space where semantic identities are naturally separated, making anomalies easier to isolate.

Memory Module and the "Forgetting" Mechanism

The memory module maintains "prototypes" representing cluster centers of normal data. It performs three key operations:

  • Reading: Measures feature consistency by comparing samples to prototypes.
  • Writing: Updates prototypes using features from the training queue.
  • Forgetting: To handle "polluted" training data containing outliers, the model tracks prototype support. Prototypes with low support—likely representing anomalies—are suppressed using Gaussian noise. This ensures the memory primarily stores "normal" patterns.

Experimental Results

MCOD was evaluated on standard benchmarks including MNIST, Fashion-MNIST, CIFAR-10, and CIFAR-100. The framework demonstrates significant performance gains over state-of-the-art methods, particularly on complex datasets.

Comparison of AUROC scores across different datasets as the outlier proportion increases. MCOD (red circles) consistently outperforms baseline methods.

On the CIFAR-100 dataset with a 10% outlier proportion, MCOD achieved an AUROC of 87.7%, a stark improvement over the 51.2% achieved by a standard Convolutional Autoencoder (CAE). Furthermore, MCOD maintains stability even as the outlier proportion increases to 20%, thanks to the robustness of the memory module's filtering capabilities.

Discussion and Conclusion

The success of MCOD highlights that pixel-level reconstruction is often a distracting proxy for outlier detection. By focusing on feature-space consistency and implementing an active "forgetting" mechanism, the model effectively purifies its internal representation of normalcy.

A primary limitation is the "Minority Assumption": the system relies on outliers being infrequent. If outliers exceed approximately 30% of the dataset, they may begin to be perceived as legitimate patterns by the memory module. Future research will explore the use of prior features to further strengthen the model's initial understanding of "normal" data.

Summary updated

BibTeX
@article{huyan2021unsupervised,
  author = {Ning Huyan and Dou Quan and Xiangrong Zhang and Xuefeng Liang and Jocelyn Chanussot and Licheng Jiao},
  title = {{Unsupervised Outlier Detection using Memory and Contrastive Learning}},
  journal = {IEEE Trans. Image Process.},
  year = {2021},
  doi = {10.1109/tip.2022.3211476},
}
Figure