EDTER: Edge Detection with Transformer

Mengyang Pu, Yaping Huang, Yuming Liu, Qingji Guan, Haibin Ling · DOI

Abstract

Convolutional neural networks have made significant progress in edge detection by exploring context and semantic features. However, local details are often suppressed as receptive fields enlarge. We propose Edge Detection TransformER (EDTER), a novel transformer-based edge detector that extracts clear object boundaries by simultaneously exploiting full image context and detailed local cues. EDTER operates in two stages: a global transformer encoder captures long-range dependencies on coarse patches, while a local transformer encoder excavates short-range cues on fine-grained patches. A Bi-directional Multi-Level Aggregation (BiMLA) decoder and a Feature Fusion Module (FFM) combine these features for precise edge prediction. EDTER achieves state-of-the-art results on BSDS500, NYUDv2, and Multicue.

Introduction

Edge detection is a foundational task in computer vision, yet it faces a persistent "receptive field" dilemma. Traditional methods relying on local cues like color and texture often produce noisy results due to a lack of semantic understanding. Conversely, modern CNN-based methods excel at capturing global context but often lose precise, pixel-level boundary details as the receptive field expands to identify objects.

Vision Transformers (ViTs) offer a potential solution through their ability to model long-range dependencies. However, applying Transformers to high-resolution images for edge detection is computationally expensive. EDTER (Edge Detection TransformER) addresses this by employing a two-stage "Global-to-Local" architecture that captures both high-level semantic context and fine-grained structural details without excessive computational cost.

Methodology: Global-to-Local Transformer

EDTER utilizes a two-stage framework to balance semantic understanding with structural precision.

Stage I: Global Context Modeling

The input image is divided into coarse-grained patches (e.g., 16x16). A global transformer encoder processes these patches to capture long-range dependencies and semantic cues. This stage provides the "prior knowledge" of where boundaries are likely to exist based on object shapes and scene layout.

Stage II: Local Refinement

To recover fine details, a local transformer encoder operates on fine-grained patches (e.g., 8x8). To maintain computational efficiency, EDTER uses a non-overlapping sliding window approach, restricting attention calculations to local regions.

EDTER captures both global context (leopard) and fine local details (branches).

Architectural Innovations

  • Bi-directional Multi-Level Aggregation (BiMLA): This decoder uses both top-down and bottom-up paths to enhance information flow, ensuring that low-level structural cues are preserved alongside high-level semantic features.
  • Feature Fusion Module (FFM): The FFM treats global context as a guide to modulate local features, resulting in an edge map that is both semantically meaningful and structurally precise.

Experimental Results

EDTER was evaluated on standard benchmarks including BSDS500, NYUDv2, and Multicue, achieving new state-of-the-art (SOTA) results across the board.

Quantitative Performance

  • BSDS500: Reached an Optimal Dataset Scale (ODS) of 0.824 with single-scale testing, and 0.848 with multi-scale testing and PASCAL VOC pre-training.
  • NYUDv2: Achieved an ODS of 0.774, a significant 2.6% improvement over previous methods.
  • Multicue: Set records for both "Boundary" (0.861) and "Edge" (0.894) tasks.

Qualitative Analysis

Visually, EDTER produces cleaner and more continuous boundaries compared to CNN-based methods, especially in complex scenes with overlapping objects or thin structures. The model successfully avoids the "blurry" or disconnected edges typical of traditional CNN architectures.

Qualitative results showing crisp edge maps for complex scenes involving people and animals.

Conclusion

EDTER represents a significant shift in edge detection by moving from CNNs to a dual-stage Transformer architecture. By effectively combining global semantic context with local structural cues, it produces high-quality, crisp edge maps that outperform existing methods. While current outputs may still require post-processing for single-pixel width, EDTER sets a new benchmark for boundary precision in natural images.

Summary updated

BibTeX
@inproceedings{pu2022edter,
  author = {Mengyang Pu and Yaping Huang and Yuming Liu and Qingji Guan and Haibin Ling},
  title = {{EDTER: Edge Detection with Transformer}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.00146},
}
Figure