Loss Max-Pooling for Semantic Image Segmentation

Samuel Rota Bulò, Gerhard Neuhold, Peter Kontschieder

Abstract

Semantic image segmentation often struggles with class imbalance and hard-to-learn pixels. We present Loss Max-Pooling (LMP), a novel loss layer that adaptively re-weights pixels during training based on their current loss. By focusing on pixels with the highest current losses, LMP naturally compensates for class imbalances and "hard" examples without requiring pre-calculated class statistics. Experiments on Cityscapes and Pascal VOC 2012 demonstrate significant improvements in mean Intersection over Union (mIoU), particularly for rare categories.

Introduction

In semantic image segmentation, not all pixels contribute equally to the learning process. Real-world datasets typically exhibit a "long tail" distribution where a few majority classes (e.g., road, sky, building) account for the vast majority of pixels, while critical minority classes (e.g., pedestrians, bicycles, traffic lights) are rare. Standard training using an average loss across all pixels often leads to models that master easy majority classes but fail on difficult minority ones. Existing solutions like static cost-sensitive learning or over-sampling are often inflexible or prone to overfitting.

Methods: Loss Max-Pooling

We propose the Loss Max-Pooling (LMP) operator to address these challenges. Instead of a simple average, the loss is defined as an upper bound of the traditional loss, obtained by maximizing pixel weights within a constrained space. This forces the optimizer to prioritize "fixing" the parts of the image the model is currently struggling with.

The weighting function is governed by two key hyperparameters:

  • Selectivity ($p$): Controls how much focus is placed on high-loss pixels versus spreading the weight.
  • Support ($m$): Defines the minimum number of pixels that must be "supported" by the weighting function.
Adaptive re-weighting behavior under varying hyperparameters p (left) and m/n (right). Higher p-values and lower m/n ratios concentrate weights on high-loss pixels.

LMP is class-agnostic; it simply looks at the loss. This allows it to handle both inter-class imbalance (rare vs. common categories) and intra-class imbalance (hard vs. easy instances of the same category) dynamically. As the model learns to segment "road" perfectly, the loss for those pixels drops, and the model's "attention" automatically shifts to harder, unlearned areas.

Experimental Results

The authors evaluated LMP on the Cityscapes and Pascal VOC 2012 benchmarks. On Cityscapes, the LMP approach achieved 75.06% mIoU, a significant improvement over the 72.55% baseline.

Boosting the "Underdogs"

The method showed dramatic improvements in minority classes. The gain for classes like "motorcycle" and "bus" was significantly higher than for common classes like "road" or "vegetation."

LMP performance gain over baseline vs. class frequency (number of pixels). Rare classes on the left show the most significant improvements.

Qualitative results indicate that models trained with LMP begin to identify small, difficult structures—such as traffic light poles—much earlier in the training process compared to standard log-loss models.

Conclusion

Loss Max-Pooling provides a robust, dynamic mechanism for handling pixel-level imbalance in semantic segmentation. By adaptively focusing on high-loss regions, it improves performance on rare and difficult classes without the need for manual class weighting. Future work could explore the integration of LMP with multi-scale testing or Conditional Random Fields (CRFs) to further enhance segmentation accuracy.

Summary updated

BibTeX
@inproceedings{bulo2017loss,
  author = {Samuel Rota Bulò and Gerhard Neuhold and Peter Kontschieder},
  title = {{Loss Max-Pooling for Semantic Image Segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2017},
  doi = {10.1109/cvpr.2017.749},
}
Figure