Unilaterally Aggregated Contrastive Learning with Hierarchical Augmentation for Anomaly Detection

Guodong Wang, Yunhong Wang, Jie Qin, Dongming Zhang, Xiuguo Bao, Di Huang

Introduction

Anomaly Detection (AD) is the critical task of identifying data points that deviate from a "normal" distribution. In many practical applications, such as medical imaging or industrial quality control, only "normal" data (inliers) is available for training. While recent self-supervised methods utilize "virtual outliers" (e.g., rotated images) to learn boundaries, they often fail to create a sufficiently compact representation of normality. Standard contrastive learning, which focuses on instance discrimination, inadvertently pushes normal samples away from each other, preventing the formation of a concentrated "normality" cluster.

Methods: UniCon-HA

The proposed Unilaterally Aggregated Contrastive Learning with Hierarchical Augmentation (UniCon-HA) framework addresses these limitations through three core components:

  1. Unilateral Aggregation: Unlike standard contrastive learning that treats every image as a unique class, UniCon-HA treats all inliers as a single class. It uses a supervised contrastive loss to pull all normal samples into a tight cluster while simultaneously treating each virtual outlier (created via rotation) as a distinct instance to be dispersed across the latent space.
  2. Soft Aggregation (SA): To handle "noisy" augmented samples that may lose their semantic identity (e.g., a crop of a plane that only shows blue sky), the authors introduce a soft re-weighting mechanism. This mechanism measures the similarity of an augmented view to the inlier group, effectively down-weighting samples that have drifted too far semantically.
  3. Hierarchical Augmentation (HA): Following a curriculum learning approach, the model applies weaker augmentations at shallow network layers to capture low-level features and stronger augmentations at deeper layers for high-level semantics.
Overview of the UniCon-HA framework, illustrating Unilaterally Aggregated Contrastive Learning and the Hierarchical Augmentation strategy.

Key Insights and Results

The primary innovation of UniCon-HA is the realization that effective AD requires the tightest possible "ball" of normality. By treating inliers as a monolith and outliers as individuals, the model creates much more precise decision boundaries than previous methods like CSI or DROC.

Comparison of latent space distributions and decision boundaries across different methods. UniCon-HA (d) demonstrates a significantly more concentrated inlier cluster compared to RotNet, DROC, and CSI.

UniCon-HA achieves state-of-the-art (SOTA) performance across several benchmarks:

  • CIFAR-10: Reached a mean AUROC of 95.4%, increasing to 96.9% with Outlier Exposure (OE).
  • ImageNet-30: Achieved 93.2% AUROC, outperforming the previous SOTA (CSI) at 91.6%.
  • Robustness: The model maintains high performance in both labeled and unlabeled multi-class settings, demonstrating its versatility in complex data environments.

Limitations and Future Work

While UniCon-HA excels at detecting semantic anomalies (e.g., distinguishing a cat from a dog), its performance on the MvTec-AD industrial dataset (89.8% AUROC) was slightly lower than specialized methods like CutPaste (95.2%). This indicates that while rotation is a powerful proxy for general object anomalies, it may not fully capture subtle local defects like scratches or punctures. Future work may explore domain-specific transformations beyond rotation to broaden the framework's applicability to specialized fields like medical imaging or industrial inspection.

Summary updated

BibTeX
@inproceedings{wang2023unilaterally,
  author = {Guodong Wang and Yunhong Wang and Jie Qin and Dongming Zhang and Xiuguo Bao and Di Huang},
  title = {{Unilaterally Aggregated Contrastive Learning with Hierarchical Augmentation for Anomaly Detection}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
}
Figure