DiffusionEdge: Diffusion Probabilistic Model for Crisp Edge Detection

Yunfan Ye, Kai Xu, Yuhang Huang, Renjiao Yi, Zhiping Cai

Abstract

Limited by the encoder-decoder architecture, learning-based edge detectors usually have difficulty predicting edge maps that satisfy both correctness and crispness. With the recent success of the diffusion probabilistic model (DPM), we found it is especially suitable for accurate and crisp edge detection since the denoising process is directly applied to the original image size. Therefore, we propose the first diffusion model for the task of general edge detection, which we call DiffusionEdge. To avoid expensive computational resources while retaining the final performance, we apply DPM in the latent space and enable the classic cross-entropy loss which is uncertainty-aware in pixel level to directly optimize the parameters in latent space in a distillation manner. We also adopt a decoupled architecture to speed up the denoising process and propose a corresponding adaptive Fourier filter to adjust the latent features of specific frequencies. With all the technical designs, DiffusionEdge can be stably trained with limited resources, predicting crisp and accurate edge maps with much fewer augmentation strategies. Extensive experiments on four edge detection benchmarks demonstrate the superiority of DiffusionEdge both in correctness and crispness. On the NYUDv2 dataset, compared to the second best, we increase the ODS, OIS (without post-processing) and AC by 30.2%, 28.1% and 65.1%, respectively.

Introduction

Edge detection is a fundamental problem in computer vision, yet modern deep learning models often struggle to balance correctness (identifying true edges) with crispness (producing thin, precise lines). Traditional encoder-decoder architectures frequently produce thick, blurry edge maps that require post-processing like Non-Maximum Suppression (NMS). Introduced at AAAI 2024, DiffusionEdge is the first diffusion-based model designed for general edge detection, aiming to provide sharp, single-pixel-width edge maps directly from the model output.

Methodology

DiffusionEdge leverages the iterative refinement capabilities of Diffusion Probabilistic Models (DPMs) to overcome the spatial "smearing" common in standard upsampling layers. The framework incorporates three primary innovations:

  1. Latent Space Diffusion: To maintain computational efficiency, the model operates in a 4x downsampled latent space. A pre-trained autoencoder manages the transitions between pixel and latent spaces.
  2. Adaptive Fourier Filter: A learnable FFT-filter is integrated into the denoising U-Net. This allows the model to adaptively adjust frequency components, helping to distinguish sharp edge signals from high-frequency background noise.
  3. Uncertainty Distillation: To handle the inherent uncertainty in human-annotated edge datasets, the authors use a pixel-level cross-entropy loss. By employing a distillation strategy, gradients are passed directly to the latent space, bypassing the heavy decoder during training to reduce memory consumption by approximately 1.5x.
The DiffusionEdge framework: The top row shows the uncertainty-aware distillation (UAED) while the bottom row illustrates the latent diffusion process conditioned on the input image.

Experimental Results

The model was evaluated on four major benchmarks: BSDS500, NYUDv2, Multicue, and BIPED. DiffusionEdge achieved state-of-the-art performance, particularly in Average Crispness (AC). On the NYUDv2 dataset, it improved the ODS score by 30.2% and the AC by 65.1% compared to previous leading models like EDTER.

Qualitative comparison showing the crisp edge maps produced by DiffusionEdge compared to the blurry outputs of standard architectures (UAED).

Qualitatively, the model produces highly precise boundaries without the "halo" noise typical of CNN or Transformer-based detectors. Notably, DiffusionEdge achieves these results without requiring traditional post-processing steps.

Conclusion

DiffusionEdge demonstrates that diffusion models are exceptionally well-suited for edge detection tasks where spatial precision is paramount. While inference speed remains a challenge compared to real-time CNN detectors, the model's ability to generate crisp, accurate edges with minimal augmentation and no post-processing marks a significant advancement in the field. Future work will focus on optimizing the diffusion process for real-time applications.

Summary updated

BibTeX
@inproceedings{ye2024diffusionedge,
  author = {Yunfan Ye and Kai Xu and Yuhang Huang and Renjiao Yi and Zhiping Cai},
  title = {{DiffusionEdge: Diffusion Probabilistic Model for Crisp Edge Detection}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=YgVUpYSrps},
}
Figure