AE-FLOW: Autoencoders with Normalizing Flows for Medical Images Anomaly Detection

Yuzhong Zhao, Qiaoqiao Ding, Xiaoqun ZhangICLR 2023

Introduction

In clinical practice, "normal" medical images are abundant, but "abnormal" ones—representing specific, often rare pathologies—are scarce and highly variable. This imbalance makes traditional supervised classification challenging. To address this, researchers increasingly turn to unsupervised anomaly detection, where a model learns the distribution of "normal" anatomy and flags any deviations as potential issues.

Existing unsupervised methods typically fall into two categories:

  1. Reconstruction-based (e.g., Autoencoders): These models compress and rebuild an image, assuming they will fail to accurately reconstruct an unseen anomaly. However, Autoencoders (AEs) often produce blurry reconstructions, leading to false anomaly detections at edges and boundaries.
  2. Likelihood-based (e.g., Normalizing Flows): These map images to a simple, tractable probability distribution (like a Gaussian). While excellent at estimating the statistical likelihood of an image, they often ignore the spatial and structural relationships crucial for radiological diagnosis.

To bridge this gap, AE-FLOW introduces a hybrid deep learning framework that combines the structural consistency of Autoencoders with the probabilistic precision of Normalizing Flows (NF).

Methodology: The AE-FLOW Architecture

The AE-FLOW architecture operates as a "sandwich" pipeline, integrating a normalizing flow directly into the bottleneck of an autoencoder.

Detailed architecture of the AE-FLOW framework.
  • The Encoder: The model utilizes a pretrained Wide ResNet-50-2 to extract high-level, semantically rich features from the input medical image.
  • The Flow Bottleneck: This is the core innovation. Instead of a standard latent space, the extracted features pass through a series of invertible mappings (Normalizing Flows). During training on purely normal data, the flow learns to map these features to the center of a standard Gaussian distribution (representing high density/likelihood).
  • The Decoder: The network then reconstructs the image from these "normalized" features.

Dual-Component Scoring

To identify anomalies during inference, AE-FLOW calculates a combined anomaly score based on two distinct factors:

  1. Flow Score: Measures how far the latent features fall into the "tails" of the learned probability distribution.
  2. Reconstruction Score: Measures the structural difference between the original image and the reconstructed version, typically evaluated via Structural Similarity Index Measure (SSIM).

By training the model to minimize both a flow loss and a reconstruction loss, AE-FLOW captures both the statistical likelihood and the geometric structure of normal medical images.

Key Insights and Results

The authors evaluated AE-FLOW on four distinct medical datasets (OCT retinal scans, Chest X-rays, ISIC2018 skin lesions, and BraTS2021 brain MRIs) as well as one non-medical benchmark (MIIC for integrated circuits).

ROC curves comparing AE-FLOW against baseline methods across four medical datasets.

AE-FLOW achieved state-of-the-art performance across the board, measured by the Area Under the ROC Curve (AUC):

  • OCT: 98.15% AUC (outperforming the next best method, Fastflow, at 94.08%)
  • Chest X-ray: 92.00% AUC
  • ISIC2018: 87.79% AUC
  • BraTS2021: 81.58% AUC

The "Tail" Effect and Interpretability

Because the flow model is trained exclusively on normal data, abnormal features are pushed to the "tails" of the Gaussian distribution. This makes it mathematically difficult for the decoder to reconstruct the original abnormal structure. Consequently, the model effectively "erases" the lesion in the reconstructed image, making the anomaly stand out starkly in the residual difference map.

Unlike pure likelihood models, this dual approach provides pixel-level heatmaps. For example, in retinal scans, the residual images clearly highlight the specific shapes of lesions that the model failed to reconstruct, offering crucial structural interpretability for clinicians.

Limitations and Future Work

While AE-FLOW demonstrates robust results, a few areas remain open for future exploration:

  • Hyperparameter Sensitivity: The model relies on weighting parameters for loss and scoring. While default values worked well generally, they may require fine-tuning for vastly different imaging modalities.
  • Pretrained Dependency: The encoder relies on ImageNet-pretrained weights. An encoder pretrained specifically on a massive medical corpus could potentially yield even richer feature extraction.
  • Computational Complexity: Normalizing flows involve numerous invertible blocks, making them more computationally expensive during training than standard autoencoders.

Overall, AE-FLOW represents a significant step forward, proving that combining probabilistic flows with structural reconstruction can make unsupervised anomaly detection highly reliable for real-world clinical screening.

Summary updated

BibTeX
@inproceedings{zhao2023ae,
  author = {Yuzhong Zhao and Qiaoqiao Ding and Xiaoqun Zhang},
  title = {{AE-FLOW: Autoencoders with Normalizing Flows for Medical Images Anomaly Detection}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=9OmCr1q54Z},
}
Figure