Abstract
The Jaccard index, also known as Intersection-over-Union (IoU), is one of the most critical evaluation metrics in image semantic segmentation. However, direct optimization of IoU score is very difficult because the learning objective is neither differentiable nor decomposable. Although some algorithms have been proposed to optimize its surrogates, there is no guarantee provided for the generalization ability. In this paper, we propose a margin calibration method, which can be directly used as a learning objective, for an improved generalization of IoU over the data-distribution, underpinned by a rigid lower bound. This scheme theoretically ensures a better segmentation performance in terms of IoU score. We evaluated the effectiveness of the proposed margin calibration method on seven image datasets, showing substantial improvements in IoU score over other learning objectives using deep segmentation models.
Introduction
In the field of semantic segmentation, the primary goal is to assign a class label to every pixel in an image. The standard metric for evaluating these models is the Intersection-over-Union (IoU), or Jaccard index. Despite its importance, most deep learning models are trained using Cross-Entropy (CE) loss. CE focuses on pixel-wise accuracy, which often fails to capture the structural quality of segmentation, particularly in datasets with significant class imbalance. For instance, a model can achieve high accuracy by ignoring small, rare objects that are crucial for the task, resulting in a poor IoU for those classes.
Furthermore, there is often a significant "generalization gap" between training and validation IoU. This paper addresses these challenges by introducing a distribution-aware margin calibration method that directly optimizes a lower bound of the IoU, ensuring better performance on unseen data.
Methodology: Distribution-Aware Margin Calibration
The proposed method shifts the focus from simple loss re-weighting to adjusting the decision boundaries, or "margins," between classes. This approach is inspired by the margin-based learning in Support Vector Machines (SVMs).
1. Distribution-Aware Margins
The core idea is to calculate class-specific margin offsets ($\rho$) based on the label frequency in the training set. Minority classes—those with fewer pixels—are assigned larger margins. This forces the model to learn more robust and discriminative features for rare objects, preventing them from being "submerged" by dominant background classes.
2. $\rho$-calibrated Log-Loss
Because hard margin losses are non-smooth and difficult to optimize via backpropagation, the authors introduce a smooth surrogate called the $\rho$-calibrated log-loss. This function approximates the margin behavior while remaining differentiable.
3. Theoretical Foundation
The method is underpinned by a mathematical proof showing that maximizing a specific lower bound of the empirical IoU minimizes the generalization error. This provides a theoretical guarantee that the learned model will perform well across the entire data distribution, not just the training samples.
Experimental Evaluation
The effectiveness of margin calibration was tested across seven diverse benchmarks, including the Robotic Instrument dataset (surgical video), COCO-Stuff 10K, PASCAL VOC 2012, MIT SceneParse150 (ADE20K), and street-view datasets like Cityscapes and BDD100K.
Key Results
The proposed method consistently outperformed standard baselines such as Cross-Entropy, Focal Loss, and Lovász-softmax.
- Robotic Instrument: Achieved a 72.5% mIoU, a 3.0% improvement over Focal Loss.
- Cityscapes: Reached a competitive 81.1% mIoU on the test server.
- MIT SceneParse150: Improved mIoU by 0.9% over standard categorical cross-entropy.
The training curves demonstrate that the margin calibration method leads to stable convergence and a smaller gap between training and validation performance compared to traditional surrogates like Lovász-softmax.
Discussion and Conclusion
The primary insight of this work is that shifting decision boundaries (margins) is more effective for IoU optimization than simply re-weighting pixel losses. By making these margins distribution-aware, the model explicitly accounts for class imbalance and generalization requirements. While the method introduces a slight computational overhead, its "plug-and-play" nature makes it easy to integrate into existing workflows. Future work may extend this distribution-aware approach to other non-decomposable metrics like Average Precision (AP) in object detection.
Summary updated