DermoSegDiff: A Boundary-aware Segmentation Diffusion Model for Skin Lesion Delineation

Afshin Bozorgpour, Yousef Sadegheih, Amirhossein Kazerouni, Reza Azad, Dorit MerhofarXiv 2023

TL;DR

DermoSegDiff introduces a boundary-aware denoising diffusion probabilistic model (DDPM) specifically tailored for skin lesion segmentation. By incorporating a novel boundary-prioritizing loss function and a dual-path U-Net architecture, it successfully tackles fuzzy boundaries and low-contrast lesions, outperforming state-of-the-art CNNs and Transformers on standard dermatological benchmarks.

What Problem Does This Paper Address?

Accurate skin lesion segmentation is a critical first step in diagnosing skin cancers like melanoma. However, automated systems frequently struggle because lesions often feature highly irregular, fuzzy boundaries, or share almost identical color profiles with the surrounding healthy skin.

Recently, Denoising Diffusion Probabilistic Models (DDPMs) have shown immense promise in medical image segmentation. However, standard diffusion approaches treat all pixels equally during training. This uniform weighting causes the model to overlook the fine-grained spatial relationships at the edges, leading to saturated or overly smoothed segmentation boundaries. The authors of this paper set out to make diffusion models inherently "boundary-aware."

Methods

DermoSegDiff improves upon standard diffusion segmentation frameworks through two main innovations: a boundary-aware loss function and a specialized dual-path denoising network.

Fig. 1: (a) illustrates the architecture of the baseline, and (b) presents our pro- posed DermoSegDiff framework.

1. Boundary-Aware Loss Function

Instead of using a standard mean squared error (MSE) loss that treats all regions uniformly, the authors introduce a dynamic weighting parameter, $W_\Theta$, into the loss formulation: $$\mathcal{L}_w = (1 + \alpha W_\Theta) \mathcal{L}_b$$ To compute $W_\Theta$, the model extracts the boundary pixels from the ground truth mask, computes a Euclidean distance map, and applies gamma correction. Crucially, this parameter is time-dependent: early in the denoising process (when noise is high), the model focuses on global structure; as it approaches the clean image ($x_0$), the weight shifts heavily toward perfecting the exact boundaries.

2. Dual-Path Denoising Network

Rather than simply concatenating the noisy mask and the raw guidance image at the input layer, DermoSegDiff utilizes a U-Net architecture featuring a dual-path encoder:

  • The Left Path extracts noise-related features.
  • The Right Path focuses purely on semantic information from the guidance image.
Fig. 2: The overview of the proposed denoising network architecture. The nota- tion L-Att, RB, EM, DM, LS-Att, and S-Att correspond to the Linear Attention, ResNet Block, Encoder Modules, Decoder Modules, Linear Self-Attention, and Self-Attention modules, respectively.

A feedback mechanism connects the two paths, allowing semantic features to dynamically guide the noise path. At the bottleneck, a Linear Self-Attention (LS-Att) module runs standard self-attention (for spatial relationships) and linear attention (for semantic context) in parallel to optimize feature representation without massive computational overhead.

Datasets

The model was trained and evaluated on three widely recognized, publicly available skin lesion datasets:

  • ISIC 2018: A large-scale dataset from the International Skin Imaging Collaboration.
  • PH²: A dermoscopic image database known for detailed clinical annotations.
  • HAM10000: A collection of multi-source dermatoscopic images.

All images were downsampled to $128 \times 128$ pixels following standard preprocessing protocols in literature.

Key Insights and Ideas

  • The Importance of Time-Varying Attention: The core "aha moment" is that a boundary loss shouldn't be static. In diffusion models, fine details are recovered late in the reverse process. By making the boundary weight adaptive to the timestep $t$, the network naturally learns global shape first and local edge refinement last.
  • Decoupling Noise and Semantics: Standard architectures mix noise and image guidance too early, which can blur the distinct features of each. Separating them into independent encoder paths preserves feature clarity, while cross-path feedback ensures they still inform one another.

Key Results

The authors evaluated two versions of their model: DermoSegDiff-A (using the new network architecture but standard loss) and DermoSegDiff-B (using both the new architecture and the boundary-aware loss).

Quantitative performance metrics across three datasets alongside qualitative visual boundary delineations.
  • State-of-the-Art Performance: DermoSegDiff-B achieved the highest Dice Score (DSC) on the PH² (0.9467) and HAM10000 (0.9430) datasets, outperforming top CNNs (DeepLabv3+), Transformers (Swin-Unet), and hybrid models (UCTransNet).
  • Improvement Over Baseline: Compared to the baseline diffusion model (EnsDiff), DermoSegDiff-B boosted the Dice Score by +2.18% on ISIC 2018, +3.83% on PH², and +1.65% on HAM10000.
  • Qualitative Excellence: Visual inspections confirm that the model produces much tighter, more accurate boundaries around highly irregular lesions where other models bleed into the background.

Limitations and Future Work

Despite its success, the authors noted two primary limitations:

  1. Inconsistent Ground Truths: Public datasets contain noisy or imprecise human annotations. Interestingly, the authors noted that DermoSegDiff often predicted cleaner, more clinically logical boundaries than the provided "ground truth" labels.
  2. Extreme High-Similarity Cases: When a lesion's color profile is nearly identical to the surrounding skin, the model can still fail to accurately segment the region.

Future work will focus on developing techniques to better handle these ultra-low-contrast edge cases.

Summary updated

BibTeX
@misc{bozorgpour2023dermosegdiff,
  author = {Afshin Bozorgpour and Yousef Sadegheih and Amirhossein Kazerouni and Reza Azad and Dorit Merhof},
  title = {{DermoSegDiff: A Boundary-aware Segmentation Diffusion Model for Skin Lesion Delineation}},
  year = {2023},
  eprint = {2308.02959},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.02959},
}
Figure