Pixel Difference Networks for Efficient Edge Detection

Zhuo Su, Wenzhe Liu, Zitong Yu, Dewen Hu, Qing Liao, Matti Pietikäinen, Li Liu

Abstract

Modern edge detection has shifted from lightweight traditional operators to heavy deep learning models that rely on massive, pre-trained classification backbones. While effective, these models are computationally expensive and often fail to capture the fundamental gradient-based nature of edges. We present PiDiNet (Pixel Difference Network), a lightweight architecture that integrates traditional pixel difference operations directly into convolutional layers. PiDiNet achieves human-level performance on the BSDS500 benchmark with fewer than 1 million parameters and operates at over 100 FPS on standard hardware, all without requiring large-scale ImageNet pre-training.

Introduction

Edge detection is a foundational low-level task in computer vision. Historically, this was addressed using handcrafted filters like Sobel, Canny, or Roberts operators, which explicitly calculate local intensity gradients. In the deep learning era, state-of-the-art solutions have largely abandoned these principles in favor of deep CNNs (e.g., VGG16 or ResNet) originally designed for high-level semantic tasks.

While these deep models achieve high accuracy, they come with significant drawbacks: they are memory-intensive, energy-hungry, and typically require pre-training on millions of images. Furthermore, standard CNN kernels are initialized randomly and may struggle to efficiently learn the specific gradient features necessary for precise edge localization. PiDiNet bridges this "lost wisdom" gap by creating a network that is inherently gradient-aware and extremely efficient.

Methodology: Pixel Difference Convolution (PDC)

The core innovation of PiDiNet is the Pixel Difference Convolution (PDC). Unlike standard convolutions that multiply weights by raw pixel values, PDC first calculates the difference between pairs of pixels within a local patch before applying weights. This architecture explicitly forces the network to focus on local gradients, mimicking the behavior of traditional edge detectors within a learnable framework.

Comparison of traditional edge detection operators, standard CNN kernels, and the proposed PDC approach.

Three Variants of PDC

Inspired by Local Binary Patterns (LBP), the authors propose three specific strategies for selecting pixel pairs:

  1. Central PDC (CPDC): Compares the center pixel to all its neighbors in the kernel.
  2. Angular PDC (APDC): Compares adjacent neighbors in a circular arrangement.
  3. Radial PDC (RPDC): Compares neighbors at varying distances from the center.

Architecture and Inference Efficiency

PiDiNet utilizes a slim backbone consisting of four stages of residual blocks. To enhance performance, it incorporates a Compact Dilation Convolution Module (CDCM) for multi-scale context and a Compact Spatial Attention Module (CSAM) to suppress background noise.

A key technical advantage of PiDiNet is its inference efficiency. The authors demonstrate that a trained PDC can be mathematically converted back into a standard vanilla convolution. This allows the model to benefit from gradient-aware learning during training while maintaining the high-speed execution of optimized standard convolution libraries during deployment.

Experimental Results

The researchers evaluated PiDiNet across several major benchmarks, including BSDS500, NYUD, and Multicue.

Performance and Speed

On the BSDS500 dataset, PiDiNet achieved an ODS F-measure of 0.807, surpassing the human perception baseline of 0.803. Remarkably, it achieves this while being approximately 15x smaller than previous leading models like RCF. The standard PiDiNet runs at 100 FPS on an NVIDIA RTX 2080 Ti, while a "tiny" version (<0.1M parameters) can reach 200 FPS.

Visual comparison of feature maps generated by vanilla convolution versus pixel difference convolution.

Training from Scratch

Unlike most modern edge detectors that fail without ImageNet pre-training, PiDiNet can be trained from scratch on target datasets (supplemented by PASCAL VOC Context) and still outperform heavy, pre-trained competitors. This demonstrates the power of using traditional logic as a strong inductive bias.

Conclusion

PiDiNet proves that handcrafted traditional computer vision logic is not obsolete but can be a powerful tool for improving the efficiency and accuracy of deep learning models. By re-integrating pixel difference operations into the convolutional framework, the authors have created a model that is compact, fast, and highly effective for real-time edge detection tasks. Future work may explore the application of PDC to other gradient-sensitive tasks such as semantic segmentation or facial recognition.

Summary updated

BibTeX
@inproceedings{su2021pixel,
  author = {Zhuo Su and Wenzhe Liu and Zitong Yu and Dewen Hu and Qing Liao and Qi Tian and Matti Pietikäinen and Li Liu},
  title = {{Pixel Difference Networks for Efficient Edge Detection}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00507},
}
Figure