Multi-layer Aggregation as a Key to Feature-Based OOD Detection

Benjamin Lambert, Florence Forbes, Senan Doyle, Michel Dojat

Abstract

Deep learning models in medical imaging often exhibit overconfidence when encountering Out-of-Distribution (OOD) data, posing significant safety risks. While feature-based OOD detection—analyzing internal network activations—is a promising solution, the optimal strategy for extracting these features remains debated. This paper investigates the efficacy of multi-layer feature aggregation compared to single-layer analysis. By evaluating several detection methods across a massive benchmark of 7,800 3D MRIs and 20 anomaly types, we demonstrate that aggregating information across the entire network architecture significantly enhances detection robustness. Our findings also highlight that the underlying model architecture (e.g., AttUNet vs. VNet) is a critical factor in detection success, as some backbones are prone to "feature collapse."

Introduction

Deep Learning (DL) models are increasingly deployed in clinical settings for tasks such as tumor segmentation. However, these models are notoriously prone to making high-confidence predictions on data that deviates from their training distribution. In medical imaging, an Out-of-Distribution (OOD) sample could range from a simple technical artifact (noise, motion blur) to a different MRI sequence or an entirely different pathology. If a model trained on brain tumors fails silently when presented with a stroke or a spinal scan, the clinical consequences can be severe.

Feature-based OOD detection has emerged as a leading strategy to mitigate this risk. Unlike uncertainty-based methods that look at the variance in final outputs, feature-based methods analyze the internal activations of the model. This study addresses two primary questions: Is it better to analyze a single representative layer or aggregate features from across the entire network? And how much does the choice of the segmentation backbone itself influence the effectiveness of these detectors?

Methodology

The researchers compared several feature-based OOD detection strategies, adapting traditional single-layer methods into multi-layer versions to test the hypothesis that different layers capture different levels of anatomical abstraction.

Detection Strategies

  1. Multi-layer Adaptation: Existing methods, including Spectral Signatures, Prototypes, and Mahalanobis Distance (MD Pool), were modified to average OOD scores across all convolutional layers rather than relying on a single layer.
  2. FRODO: A sophisticated multi-layer approach based on Mahalanobis distance that fits a multivariate Gaussian distribution to the activations of each layer.
  3. One-class SVM (OCSVM): An unsupervised approach trained to define a boundary around "normal" internal activations.
  4. Baseline (MC Dropout): A standard uncertainty-based method measuring the variance between multiple stochastic passes of the same image.

Experimental Setup

The study utilized a comprehensive benchmark of approximately 7,800 3D MRIs. The In-Distribution (ID) data consisted of T1w brain tumor MRIs from the BraTS 2021 dataset. To ensure the detectors could distinguish between benign variations and true anomalies, a "Control" set (LUMIERE) consisting of T1w brain MRIs from a different clinical center was used.

The OOD samples were categorized into 20 distinct types, including:

  • Transformation shifts: Synthetic noise, motion blur, and adversarial perturbations.
  • Modality shifts: Incorrect MRI sequences (FLAIR, T1ce) or CT scans.
  • Diagnosis shifts: Brain pathologies not present in the training set (Strokes, Epilepsy).
  • Far OOD: Scans of different body parts (Abdominal and Lumbar spine).

Results and Discussion

The Superiority of Multi-layer Aggregation

The results consistently favored multi-layer approaches. For the Spectral Signatures method, transitioning from a single-layer to a multi-layer aggregation resulted in an AUROC (Area Under the Receiver Operating Characteristic) increase of over 10%. While single-layer methods often performed well on specific OOD types (like noise), they frequently failed on others (like new pathologies). Multi-layer aggregation provided a necessary safety net, stabilizing performance across the diverse range of 20 OOD scenarios.

The Impact of Model Architecture

A significant finding was the role of the underlying model architecture. The FRODO algorithm, paired with an AttUNet backbone, was the top performer, achieving a perfect AUROC of 1.00 in 12 of the 20 OOD settings and an overall AUROC of 0.95. However, when the same FRODO algorithm was applied to a VNet backbone, the overall AUROC dropped to 0.86. This suggests that some architectures are more susceptible to "feature collapse," where OOD images are mapped into the same internal feature space as ID images, making them virtually indistinguishable to post-hoc detectors.

Feature-Based vs. Uncertainty-Based Methods

Feature-based detectors, particularly multi-layer ones, significantly outperformed traditional uncertainty methods like MC Dropout. This indicates that internal activations provide a much richer and more reliable signal for detecting distribution shifts than the variance in the model's final output.

Conclusion

This research establishes multi-layer aggregation as a key requirement for robust feature-based OOD detection in medical imaging. By looking at the "big picture" across all neural network layers, detectors can capture anomalies that might be missed at a single level of abstraction.

However, the study also highlights a critical bottleneck: the model architecture itself. Future work must focus on developing training constraints—such as Gradient Penalty or Lipschitz constraints—to prevent feature collapse and ensure that models naturally develop a discriminative feature space that is sensitive to OOD samples. Expanding these methods to a broader range of clinical applications beyond brain MRIs remains a vital next step for ensuring the safety of AI in healthcare.

Summary updated

BibTeX
@inproceedings{lambert2023multi,
  author = {Benjamin Lambert and Florence Forbes and Senan Doyle and Michel Dojat},
  title = {{Multi-layer Aggregation as a Key to Feature-Based OOD Detection}},
  booktitle = {UNSURE @ MICCAI},
  year = {2023},
  doi = {10.1007/978-3-031-44336-7\_11},
}
Figure