Residual Pattern Learning for Pixel-wise Out-of-Distribution Detection in Semantic Segmentation

Yuyuan Liu, Choubo Ding, Yu Tian, Guansong Pang, Vasileios Belagiannis, Ian D. Reid, Gustavo Carneiro

Abstract

Semantic segmentation models typically operate under a closed-world assumption, leading to overconfident misclassifications when encountering out-of-distribution (OoD) objects. This paper introduces Residual Pattern Learning (RPL), a novel framework designed to detect anomalies at the pixel level without compromising the performance of the base segmentation model. By integrating a lightweight residual module with a frozen pre-trained network and employing Context-robust Contrastive Learning (CoroCL), the proposed method achieves state-of-the-art performance across multiple anomaly detection benchmarks, including Fishyscapes and Segment-Me-If-You-Can.

Introduction

Modern semantic segmentation systems are essential for safety-critical applications like autonomous driving. However, these models are usually trained on a fixed set of categories (e.g., road, car, pedestrian). When faced with an "out-of-distribution" object—such as a moose on a highway or a fallen tree—they often assign these pixels to a known class with high confidence. This behavior is a significant hurdle for real-world deployment.

Current research generally follows two paths: post-hoc uncertainty analysis of frozen models or fine-tuning with Outlier Exposure (OE). Post-hoc methods are safe for inlier performance but often lack the sensitivity to detect "hard" anomalies. Conversely, re-training methods often suffer from "catastrophic forgetting," where the model's accuracy on original classes drops, or they fail to generalize when the background context changes. This paper seeks to bridge this gap by providing a robust, "plugin" style anomaly detector that preserves base model integrity.

Methodology

The authors propose a dual-strategy approach to enhance OoD detection while maintaining closed-set accuracy.

Residual Pattern Learning (RPL)

The core of the approach is the RPL module. Unlike standard fine-tuning, the base segmentation network is kept frozen. A lightweight residual module is inserted between the feature extractor and the segmentation head. This module learns to identify residual patterns in intermediate features that signify an anomaly. By "assisting" the frozen head rather than replacing it, RPL induces high uncertainty (low confidence) for outlier pixels without altering the decision boundaries for known classes.

Overview of the RPL and CoroCL training framework.

Context-robust Contrastive Learning (CoroCL)

To address the issue of context sensitivity—where models might flag a new background as an anomaly—the authors introduce CoroCL. This contrastive learning strategy pulls embeddings of the same category (inlier or outlier) together while pushing different categories apart. Crucially, it operates across diverse contexts, teaching the model to recognize an object as an anomaly regardless of whether the surrounding environment is a city street or a rural path.

Positive Energy Loss

The training is further stabilized using a simplified energy-based loss function. This function focuses on maximizing the "energy" (a proxy for uncertainty) of outlier pixels. Unlike previous energy-based models that require complex hyperparameter tuning, this approach is more robust to the class imbalance typically found in Outlier Exposure datasets.

Experiments and Results

The model was trained on Cityscapes (urban inliers) with COCO objects used as synthetic anomalies for Outlier Exposure. Evaluation was conducted on several rigorous benchmarks, including Fishyscapes, RoadAnomaly, and Segment-Me-If-You-Can (SMIYC).

Performance Metrics

The proposed RPL+CoroCL method significantly outperformed previous state-of-the-art (SOTA) methods like PEBAL. Key highlights include:

  • Detection Accuracy: A reduction of approximately 10% in the False Positive Rate (FPR) and a 7% increase in the Area Under Precision-Recall Curve (AuPRC) across major benchmarks.
  • Inlier Preservation: Unlike PEBAL or Meta-OoD, which saw drops in mean Intersection over Union (mIoU) for known classes, this method maintained the exact performance of the base frozen model.
  • Robustness to Small Objects: On the SMIYC "Obstacle" track, which features small objects on the road, the method achieved an AuPRC of 85.93%, a massive improvement over the previous SOTA of 4.98%.
Qualitative comparison of anomaly detection heatmaps showing superior localization of outliers.

Conclusion

Residual Pattern Learning provides a powerful and efficient way to upgrade existing semantic segmentation models for anomaly detection. By freezing the base weights and focusing on residual patterns and context-robust contrastive features, the authors demonstrate that it is possible to achieve high-sensitivity OoD detection without sacrificing original model performance. Future work will focus on further reducing the inherent uncertainty of inlier pixels to create even sharper distinctions between the known and the unknown.

Summary updated

BibTeX
@inproceedings{liu2023residual,
  author = {Yuyuan Liu and Choubo Ding and Yu Tian and Guansong Pang and Vasileios Belagiannis and Ian D. Reid and Gustavo Carneiro},
  title = {{Residual Pattern Learning for Pixel-wise Out-of-Distribution Detection in Semantic Segmentation}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
  doi = {10.1109/iccv51070.2023.00112},
}
Figure