Efficient Out-of-Distribution Detection of Melanoma with Wavelet-Based Normalizing Flows

M. M. Amaan Valiuddin, Christiaan G. A. Viviers, Ruud J. G. van Sloun, Peter H. N. de With, Fons van der Sommen

TL;DR

This paper improves melanoma detection by treating malignant tumors as "Out-of-Distribution" (OOD) anomalies relative to benign skin samples. By using Wavelet-based Normalizing Flows, the authors leverage the model's natural bias toward texture to achieve a 9% boost in detection accuracy (AUC) while reducing the model's parameter count by over 100x, making it ideal for edge-device medical diagnostics.

What Problem Does This Paper Address?

Melanoma is a deadly skin cancer, but early detection significantly improves survival rates. However, AI researchers face a data problem: in most clinical datasets, malignant cases are rare compared to benign ones. This "data imbalance" makes training standard supervised classifiers—which need many examples of both classes—notoriously difficult.

The authors propose a shift in perspective. Instead of training a model to classify malignant vs. benign, why not train a model to deeply understand what "normal" (benign) looks like? If a model can learn the probability distribution of benign skin, it can flag malignant images as "Out-of-Distribution" (OOD) because they don't fit that learned pattern.

The challenge is that Normalizing Flows (NFs)—generative models that calculate exact likelihoods—often fail at OOD detection. They tend to focus on low-level graphical features (like texture and color) rather than semantic meaning. Paradoxically, they sometimes assign higher likelihoods to "weird" OOD data than to the data they were trained on.

Methods

The researchers bridge the gap between NF biases and medical reality by using Wavelet Flow.

  1. Wavelet Decomposition: Instead of modeling raw pixels, the architecture uses the Haar wavelet transform to decompose images into low-frequency (blurry) and high-frequency (detail/texture) components across multiple scales.
  2. Inductive Bias as a Feature: Since melanoma malignancy is often identified by specific textures and irregular borders, the authors lean into the NF's natural bias toward texture.
  3. Grayscale Processing: They converted images to grayscale to prevent the model from over-relying on color-pixel correlations, which can lead to "cheating" and poor OOD performance.
  4. Masking Strategies: They experimented with various coupling layer masks (like "Radial" or "Cycle" masking) to prevent the model from simply memorizing local pixel patterns through "co-adaptation."
  5. Likelihood Averaging: The final OOD score is derived by averaging likelihoods across the most relevant wavelet decomposition scales.

Datasets

The study utilized the ISIC (International Skin Imaging Collaboration) dataset, a standard benchmark in dermatology AI.

  • Training: Performed exclusively on benign images.
  • Evaluation: Tested on a mix of benign (In-Distribution) and malignant (Out-of-Distribution) images.

Key Insights and Ideas

  • The "Bug" is a "Feature": In general computer vision, an NF's obsession with texture is a weakness. In dermatology, it’s a strength. Because malignant tumors are more "textured" and complex than benign moles, the model’s sensitivity to texture naturally helps it spot the cancer.
  • Intermediate Scales are Best: The authors found that the 3rd through 6th decomposition scales provided the best detection results. The highest resolution scale (level 7) actually performed worse, suggesting that the most "malignant-looking" features exist at a mid-range structural level rather than the finest pixel detail.
  • Massive Efficiency Gains: Because Wavelet Flow allows for independent training of levels and focuses on specific coefficients, it is incredibly lean. The best-performing model used only 1.25 million parameters, compared to the 159 million in the standard RGB Glow baseline.

Key Results

  • Accuracy Boost: The Wavelet-based NF achieved a 9% increase in Area Under Curve (AUC) for the Receiver Operating Characteristics compared to the baseline Glow model.
  • Performance: The best configuration reached an AUC of 0.78.
  • Edge-Ready: The reduction from 159M parameters to 1.25M parameters represents a ~127x decrease in model size, significantly lowering the memory requirements for deployment on mobile or edge medical devices.

Limitations and Future Work

The primary limitation identified is the "Hair Problem." Normalizing Flows assign lower likelihoods to complex, textured images. Unfortunately, a benign mole with hair on it looks "complex" to the model, leading to potential false positives.

The authors suggest that future work should include a "complexity correction term" in the likelihood calculation to account for known non-cancerous textures like hair. They also suggest this wavelet-based OOD approach could be applied to other areas of oncology where data is heavily imbalanced.

Summary updated

Abstract

Melanoma is a serious form of skin cancer with high mortality rate at later stages. Fortunately, when detected early, the prognosis of melanoma is promising and malignant melanoma incidence rates are relatively low. As a result, datasets are heavily imbalanced which complicates training current state-of-the-art supervised classification AI models. We propose to use generative models to learn the benign data distribution and detect Out-of-Distribution (OOD) malignant images through density estimation. Normalizing Flows (NFs) are ideal candidates for OOD detection due to their ability to compute exact likelihoods. Nevertheless, their inductive biases towards apparent graphical features rather than semantic context hamper accurate OOD detection. In this work, we aim at using these biases with domain-level knowledge of melanoma, to improve likelihood-based OOD detection of malignant images. Our encouraging results demonstrate potential for OOD detection of melanoma using NFs. We achieve a 9% increase in Area Under Curve of the Receiver Operating Characteristics by using wavelet-based NFs. This model requires significantly less parameters for inference making it more applicable on edge devices. The proposed methodology can aid medical experts with diagnosis of skin-cancer patients and continuously increase survival rates. Furthermore, this research paves the way for other areas in oncology with similar data imbalance issues (Code available at: https://github.com/A-Vzer/WaveletFlowPytorch ).
BibTeX
@inproceedings{valiuddin2022efficient,
  author = {M. M. Amaan Valiuddin and Christiaan G. A. Viviers and Ruud J. G. van Sloun and Peter H. N. de With and Fons van der Sommen},
  title = {{Efficient Out-of-Distribution Detection of Melanoma with Wavelet-Based Normalizing Flows}},
  booktitle = {CaPTion @ MICCAI},
  year = {2022},
  url = {https://openreview.net/forum?id=v_Y7Y_jRNZ},
}

Loading related content...

Figure