nnOOD: A Framework for Benchmarking Self-supervised Anomaly Localisation Methods

Matthew Baugh, Jeremy Tan, Athanasios Vlontzos, Johanna P. Müller, Bernhard Kainz

TL;DR

The nnOOD framework adapts the popular "no-new-U-Net" (nnU-Net) philosophy to the world of medical anomaly detection. By providing a standardized training pipeline and a common interface for self-supervised tasks, it allows researchers to finally compare different "synthetic anomaly" methods on a level playing field.

What Problem Does This Paper Address?

Detecting anomalies in medical images (like a subtle tumor on an X-ray) is notoriously difficult because "abnormal" can mean almost anything. While supervised learning works well for specific diseases, it fails to catch "universal" anomalies—things the model hasn't seen before.

Recently, the field has shifted toward self-supervised learning, where models are trained on healthy data "augmented" with synthetic anomalies (e.g., cutting a patch from one image and pasting it into another). However, comparing these methods is currently a mess. Is Method A better than Method B because its synthetic anomalies are more realistic, or just because the researchers used a better optimizer, a different learning rate, or more data augmentation? The "noise" of the training pipeline makes it impossible to isolate the effectiveness of the actual anomaly detection task.

Methods

The authors introduce nnOOD, which builds on the nnU-Net framework. nnU-Net is famous for automatically configuring its architecture and preprocessing based on the dataset. nnOOD extends this to Out-of-Distribution (OOD) detection with several key modifications:

  • Standardized Pipeline: It fixes the "boring" parts of the training (optimizers, learning rates, architectures) so that the only variable is the synthetic task being tested.
  • Early Stopping on Synthetic Data: To prevent the model from overfitting to the specific "telltale signs" of a fake anomaly, they implement early stopping based on a moving average of the Average Precision (AP) on a synthetic validation set (using a threshold of 0.875).
  • Positional Encoding: Since the "normality" of a medical feature often depends on where it is (e.g., a heart belongs in the chest, not the abdomen), they add coordinate channels (ConvCoord) to help the model understand spatial context.
  • Anomaly Oversampling: During training, 30% of patches are chosen specifically to contain at least one synthetic anomaly, ensuring the model sees enough "bad" examples to learn from.
  • Task Interface: They provide a modular interface to implement various state-of-the-art tasks like Foreign Patch Interpolation (FPI), CutPaste, Poisson Image Interpolation (PII), and Natural Synthetic Anomalies (NSA).

Datasets

The framework was evaluated using the ChestX-ray14 dataset:

  • Training: Exclusively healthy samples, split by gender (17,852 male and 14,720 female samples).
  • Testing: Samples containing 14 different thorax diseases. Since pixel-wise labels weren't available, the authors used pathology bounding boxes as "anomaly masks" for evaluation.

Key Insights and Ideas

  • The "Seamlessness" Hypothesis: The most successful methods are those that blend synthetic anomalies into the background most naturally. Methods like NSA and PII, which use gradient blending or logistic functions to smooth transitions, significantly outperformed "cruder" methods like CutPaste.
  • Sharp Edges are a Giveaway: Methods that create sharp, image-aligned discontinuities (like FPI and CutPaste) don't help the model identify real medical pathologies. Real diseases rarely look like a perfectly square patch was pasted onto an organ.
  • Task Difficulty vs. Training Time: There is a massive disparity in how long it takes to train these models. CutPaste "anomalies" are so obvious that the model reaches its performance threshold in just 27 epochs. In contrast, the subtle blending of PII requires over 312 epochs for the model to learn the nuances.
  • Location Matters: Adding positional encoding was crucial. In medical imaging, an "anomaly" is often just a normal tissue type appearing in the wrong anatomical location.

Key Results

The authors benchmarked several top-tier self-supervised tasks. The results showed a clear winner:

Task AUROC (Male PA) AP (Male PA)
FPI 0.515 0.075
CutPaste 0.484 0.071
PII 0.554 0.084
NSA 0.718 0.162
NSA (Mixed) 0.714 0.167
  • NSA (Natural Synthetic Anomalies) was the top performer, nearly doubling the Average Precision (AP) of simpler methods.
  • FPI and CutPaste performed similarly to a random classifier (which would achieve ~0.50 AUROC), suggesting they are poorly suited for X-ray pathology detection.

Limitations and Future Work

  • Inexact Ground Truth: Using bounding boxes as anomaly masks is a "noisy" way to measure pixel-level accuracy, as the box often includes healthy tissue surrounding the pathology.
  • Beyond Patch Blending: The current framework focuses on blending patches. The authors suggest that future work should explore other types of synthetic anomalies, such as deformations (warping tissue), which might more closely mimic certain medical conditions.
  • Performance Gap: While NSA performs well, there is still a significant gap between these self-supervised methods and fully supervised models. The search for the "perfect" synthetic anomaly continues.

Summary updated

BibTeX
@inproceedings{baugh2022nnood,
  author = {Matthew Baugh and Jeremy Tan and Athanasios Vlontzos and Johanna P. Müller and Bernhard Kainz},
  title = {{nnOOD: A Framework for Benchmarking Self-supervised Anomaly Localisation Methods}},
  booktitle = {UNSURE @ MICCAI},
  year = {2022},
  doi = {10.1007/978-3-031-16749-2\_10},
}

Loading related content...

Figure