Learning to predict crisp boundaries

Ruoxi Deng, Chunhua Shen, Shengjun Liu, Huibing Wang, Xinru Liu

TL;DR

Deng et al. tackle the persistent problem of "thick" edges in neural network-based boundary detection. By introducing a novel loss function based on the Dice coefficient and a refined bottom-up/top-down architecture, they enable CNNs to predict pixel-accurate, crisp boundaries directly, eliminating the need for traditional post-processing steps like Non-Maximum Suppression (NMS).

What Problem Does This Paper Address?

In computer vision, edge detection is a foundational task, but deep learning models have a frustrating quirk: they tend to produce thick, blurry boundaries. While these models are excellent at identifying semantically meaningful contours, the resulting edge maps often look like they were drawn with a thick marker rather than a fine-point pen.

The authors identify two main culprits for this "thickness" issue:

  1. Extreme Class Imbalance: In any given image, the vast majority of pixels are background, while only a tiny fraction are actual edges.
  2. The "Weighted Cross-Entropy" Trap: To handle this imbalance, standard models (like HED or RCF) use weighted cross-entropy loss. While this makes the models trainable, the authors demonstrate that this specific loss function is actually what causes the predicted edges to bleed into neighboring pixels.

Traditionally, researchers have ignored this by applying post-processing (NMS) to thin the results. This paper argues that we should aim for "crispness" by design, not by post-processing.

Fig. 1: (a) is an example image from the BSDS500 dataset [5]. (b) is the result of the Sobel detector [15]. Here (c) is the output of the HED detector [12]. (d) is the output of our proposed method. All the predictions do not apply post-processing.

Methods

The authors propose a two-pronged solution involving a new loss function and a specialized network architecture.

1. The Fusion Loss

The core innovation is a loss function that combines standard cross-entropy with a term based on the Dice coefficient. The Dice coefficient is a measure of similarity between two sets (in this case, the predicted edge map and the ground truth).

  • Image-level similarity: The Dice loss treats the edge map as a whole, focusing on how well the predicted "set" of edge pixels matches the ground truth.
  • Pixel-level difference: The cross-entropy term handles the fine-grained, pixel-by-pixel accuracy. By combining these, the model is incentivized to produce edges that are not just in the right place, but also have the right "sharpness" and distribution.

2. Bottom-Up/Top-Down Architecture

The network uses a VGG-16 backbone but adopts a sophisticated refinement strategy. It features a bottom-up path to extract hierarchical features and a top-down path to recover spatial resolution.

  • Refinement Modules: The authors use ResNeXt blocks to fuse side-output features from the backbone with the mask-encoding from the top-down path.
  • Efficiency: They replaced standard 3x3 convolutions with 1x1 convolutions and used grouped deconvolution layers to reduce model complexity (from 22.64M to 15.69M parameters) while actually improving performance and preventing overfitting.
Fig. 3: Overview of the proposed network. Blue cubics indicate the features on the bottom-up path while yellow cubics indicate the mask-encoding on the top-down path. The backbone of our network is the VGG-16 model in which the last pooling layer and all the fully connected layers are removed. The mask-encoding from conv5 3 layer repeatedly goes through the proposed refinement module to recover its resolution. In a refinement module, the mask-encoding is fused with the side-output features and then reduces its channels by a factor of 2 and double its resolution to prepare for the fusion in the next refinement module.

Datasets

The model was trained and evaluated on two primary benchmarks:

  • BSDS500 (Berkeley Segmentation Dataset): A classic dataset for edge detection containing 200 training, 100 validation, and 200 testing images, each with multiple human annotations.
  • NYUDv2 (NYU Depth Dataset): A large dataset of indoor scenes. The authors leveraged both RGB data and HHA features (encoded depth information) to improve boundary detection in complex 3D environments.

To combat the small size of these datasets, the authors employed heavy data augmentation, including scaling, rotation, and flipping, expanding the training set to over 100,000 images.

Key Insights and Ideas

  • Weighted Cross-Entropy is the Blurring Agent: The authors proved that while class-balancing weights make training possible, they are the primary reason CNNs produce thick edges. Figure 2 in the paper shows that standard cross-entropy (without weights) actually produces thinner lines, even if it fails to capture the full edge map.
  • Dice Loss as a Regularizer for Sharpness: By optimizing for set similarity (Dice) rather than just pixel classification, the network learns the "rare event" of a crisp edge more effectively.
  • Complexity vs. Performance: In edge detection, bigger isn't always better. The authors found that reducing parameters through 1x1 convolutions and grouped deconvolutions helped the model generalize better on small datasets like BSDS500.

Key Results

The proposed method achieved state-of-the-art results on both major benchmarks:

  • BSDS500: Achieved an ODS F-score of 0.815, matching or exceeding top-tier models like CED and RCF.
  • NYUDv2: Achieved a top ODS F-score of 0.762.
  • Speed: The single-scale version of the detector runs at 30 FPS on a GTX980 GPU, making it suitable for real-time applications.
  • Crispness: Quantitatively, the model's "before NMS" scores were significantly higher than competitors, proving that the output is inherently sharper.

Limitations and Future Work

The authors noted that their model, like many deep learning approaches, is susceptible to overfitting when training data is scarce. They attempted to use even more sophisticated architectures (like RefineNet) but found they performed worse due to the limited number of unique training samples in standard edge detection datasets.

For future work, the authors suggest extending this "crisp boundary" approach to other high-level vision tasks that rely on sharp edges, such as object detection and optical flow, where boundary precision is often a bottleneck for performance.

Summary updated

BibTeX
@inproceedings{deng2018learning,
  author = {Ruoxi Deng and Chunhua Shen and Shengjun Liu and Huibing Wang and Xinru Liu},
  title = {{Learning to predict crisp boundaries}},
  booktitle = {European Conference on Computer Vision},
  year = {2018},
  doi = {10.1007/978-3-030-01231-1\_35},
}
Figure