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

RankSEG: A Consistent Ranking-based Framework for Segmentation

Ben Dai, Chunlin Li · OpenReview

Abstract

Segmentation is a fundamental task in computer vision and natural language processing, assigning labels to pixels or features to extract regions of interest. Performance is typically evaluated using the Dice and Intersection over Union (IoU) metrics. In this work, we establish a theoretical foundation for segmentation relative to these metrics, introducing concepts like Dice-/IoU-calibration. We demonstrate that traditional threshold-based frameworks are often inconsistent with these metrics, leading to suboptimal results. To address this, we propose RankSEG (RankDice/RankIoU), a consistent ranking-based framework inspired by the Bayes segmentation rule. We develop efficient GPU-parallel algorithms and prove the framework's statistical properties, including excess risk bounds. Extensive experiments on CityScapes, Pascal VOC, and Kvasir-SEG datasets demonstrate that RankSEG consistently outperforms state-of-the-art architectures by optimizing for the evaluation metrics directly.

The Inconsistency of Fixed Thresholding

In modern computer vision, segmentation models are evaluated using the Dice coefficient or Intersection over Union (IoU). These metrics quantify the overlap between predicted masks and ground truth. However, a common practice is to train models using pixel-wise Cross-Entropy or Focal loss and then apply a fixed threshold (typically 0.5) to the resulting probability maps during inference.

This paper identifies a critical theoretical flaw: fixed thresholding is inconsistent with Dice/IoU metrics. Even with perfect probability estimation, a 0.5 threshold may not maximize the Dice score. The optimal threshold is actually dynamic, varying from image to image based on the underlying probability distribution. This inconsistency often results in suboptimal segmentation, particularly for small, occluded, or blurry objects where the model's confidence is less certain.

Methodology: From Thresholding to Ranking

RankSEG shifts the paradigm from absolute thresholding to a ranking-based approach. The framework consists of three primary stages:

  1. Probability Estimation: A standard deep learning backbone (e.g., ResNet, Xception) generates a probability map $p_j$ for each pixel $j$.
  2. Ranking: Pixels are ranked from highest to lowest probability.
  3. Volume Estimation ($\tau$): Instead of a fixed cutoff, the framework estimates the optimal "volume" $\tau$—the specific number of top-ranked pixels to include in the final mask.
Comparison between the traditional threshold-based segmentation pipeline and the proposed RankDice framework.

To handle high-resolution images efficiently, the authors developed specialized algorithms:

  • T-RNA (Truncated Refined Normal Approximation): Approximates the complex Poisson-binomial distributions required for the Bayes rule.
  • BA (Blind Approximation): A simplified, highly parallelizable version for GPUs that adds minimal overhead to the inference pipeline.

Theoretical Insights

  • Dice-Calibration: Similar to Fisher consistency in classification, the authors prove that RankSEG is "Dice-calibrated," whereas standard thresholding is not.
  • Adaptive Thresholding: By selecting the top $\tau$ pixels, RankSEG effectively applies an image-specific threshold, automatically adjusting to the model's confidence levels.
  • Correcting Volume Bias: Standard losses often lead to systematic over- or under-prediction of object sizes. RankSEG’s volume estimation step serves as a correction layer for this bias.

Experimental Validation

The framework was tested across diverse benchmarks: Fine-annotated CityScapes (urban scenes), PASCAL VOC 2012 (general objects), and Kvasir-SEG (medical polyp segmentation).

Key Results

  • Performance Boost: On CityScapes with a PSPNet backbone, RankSEG improved the mDice score by 3.13% over standard thresholding and 4.96% over the argmax approach.
  • Success in Difficult Cases: The most significant gains occurred in challenging categories. For instance, the Dice score for "wall" and "fence" categories improved by 23.6% and 25.7%, respectively.
  • Architecture Agnostic: The benefits were consistent across various backbones (DeepLab-V3+, PSPNet, FCN8) and loss functions (Cross-Entropy, Focal Loss), suggesting that ranking-based inference is a universal enhancement for segmentation tasks.

Limitations and Future Directions

While RankSEG provides a robust theoretical and practical framework, some challenges remain:

  • Multiclass Complexity: For non-overlapping multiclass segmentation, finding the global optimum is NP-hard. Current implementations use a greedy approximation.
  • Conditional Independence: The proofs assume pixels are conditionally independent. Future work may explore integrating spatial dependencies, such as those modeled by Conditional Random Fields (CRFs).
  • Calibration Sensitivity: The framework relies on accurate pixel ranking. If probability estimates are severely uncalibrated, performance may suffer; techniques like Temperature Scaling are suggested as potential pre-processing steps.

Summary updated

BibTeX
@article{dai2023rankseg,
  author = {Ben Dai and Chunlin Li},
  title = {{RankSEG: A Consistent Ranking-based Framework for Segmentation}},
  journal = {J. Mach. Learn. Res.},
  year = {2023},
}
Figure