NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generative Edge Detection with Stable Diffusion

Caixia Zhou, Yaping Huang, Mochu Xiang, Jiahui Ren, Haibin Ling, Jing ZhangarXiv 2024 · DOI

Abstract

Generative Edge Detector (GED) repurposes pre-trained Stable Diffusion models to perform high-quality edge detection in a single inference step. By bypassing the traditional multi-step denoising process and introducing controllable "granularity" parameters, GED achieves state-of-the-art results with significantly lower computational overhead than previous generative approaches. The model demonstrates a superior "shape bias" and the ability to generalize effectively even with extremely limited training data.

Introduction

Edge detection is a fundamental computer vision task, traditionally treated as a pixel-level classification problem. While deep learning architectures like CNNs and Transformers have pushed performance beyond human levels, these models often struggle with "texture bias"—getting distracted by patterns inside an object rather than its boundary.

Recently, generative models, particularly Diffusion models, have shown a "shape bias" that aligns better with human perception. However, existing diffusion-based edge detectors are slow because they require dozens of iterative denoising steps. Furthermore, edge detection is inherently subjective; one person might want only the main outlines, while another wants every fine detail. GED aims to solve both the efficiency and subjectivity problems by leveraging the rich internal representations of Stable Diffusion.

Methodology

The authors propose a novel framework that treats Stable Diffusion not as a noise-remover, but as a rich feature extractor and latent predictor.

Comparison of the proposed GED architecture with traditional diffusion training and finetuning approaches.

As illustrated in the architecture comparison above, GED moves away from iterative denoising (a, b) toward a direct latent prediction approach (c). Instead of starting from random noise and denoising over 50 steps, GED takes the latent representation of a clean image (via the VAE encoder) and feeds it into a finetuned version of Stable Diffusion's denoising U-Net. It predicts the "latent edge map" directly in a single step ($t=1$).

To handle subjectivity, the authors introduce a "granularity" scalar ($g \in [0, 1]$). This value is encoded and added to the U-Net's time embeddings. A low $g$ tells the model to find rough object contours, while a high $g$ prompts it to find intricate details. To ensure this control is effective, they employ Ordinal Regularization ($\mathcal{L}_{ord}$), which enforces a consistent relationship between different granularity levels (e.g., ensuring a detailed map contains the information of a rougher map).

Key Results and Controllability

GED was evaluated on four standard benchmarks: BSDS500, Multicue, NYUD, and BIPED. The model achieved a state-of-the-art ODS (Optimal Dataset Scale) score of 0.870 on the BSDS500 test set, surpassing previous leaders like DiffusionEdge and EdgeSAM.

Visual comparison of edge detection results at different granularity levels (0 vs 1) compared to Ground Truth (GT).

Beyond accuracy, the model offers unique controllability. As shown in the figure above, the granularity parameter allows users to generate a spectrum of edge maps for a single input image. By moving from multi-step denoising to a single-step prediction, GED is significantly faster than previous generative methods while using fewer trainable parameters (116M vs. 225M in DiffusionEdge).

Discussion and Insights

A striking finding of this research is the "Power of Priors." GED can achieve competitive performance (0.788 ODS on BSDS) using only 1% of the training data (just 3 images). This highlights how much "common sense" about boundaries the model already possesses from its original text-to-image training. Additionally, GED produces "crisp" edges because it learns to align with the sharp latent distributions of the VAE, avoiding the blurriness often seen in standard discriminative models trained with weighted cross-entropy.

Conclusion

GED demonstrates that the "intelligence" of Stable Diffusion lies in its pre-trained weights, not necessarily the iterative denoising process. By "skipping the loop," the authors have created an efficient, controllable, and highly accurate edge detector. Future work will focus on constructing dedicated datasets with explicit granularity labels to further refine the model's controllable nature and exploring lighter backbones for mobile applications.

Summary updated

BibTeX
@misc{zhou2024generative,
  author = {Caixia Zhou and Yaping Huang and Mochu Xiang and Jiahui Ren and Haibin Ling and Jing Zhang},
  title = {{Generative Edge Detection with Stable Diffusion}},
  year = {2024},
  eprint = {2410.03080},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.03080},
}
Figure