CAR: Class-Aware Regularizations for Semantic Segmentation

Ye Huang, Di Kang, Liang Chen, Xuefei Zhe, Wenjing Jia, Linchao Bao, Xiangjian He

Abstract

Semantic segmentation requires precise pixel-level classification, yet many state-of-the-art models suffer from context bias and inefficient feature fusion. We introduce Class-Aware Regularization (CAR), a universal "plug-and-play" training module designed to optimize feature representations by explicitly grouping pixels of the same class while separating distinct categories. By leveraging ground-truth labels during training to calculate class centers, CAR enforces intra-class compactness and inter-class distance. Experimental results demonstrate that CAR improves performance by up to 2.23% mIOU across various architectures with zero additional cost during inference.

Introduction

In semantic segmentation, recent high-performing models like OCRNet and CPNet attempt to utilize "class-level" information—global summaries of specific categories—to assist in pixel classification. However, these approaches often face three critical challenges:

  1. Inefficient Fusion: Class-level features are often simply concatenated to pixel features without forcing the network to learn more separable representations.
  2. Error Accumulation: Many models estimate class centers based on "coarse" initial predictions. If these initial guesses are incorrect, the resulting class centers are noisy, leading to a cycle of errors.
  3. Context Bias: Models frequently over-rely on surrounding context (e.g., assuming a cow must be on grass), which hinders generalization to novel scenes.
Figure 1: Motivation for CAR. Without CAR, feature maps are easily affected by background classes like grass. CAR uses three specific regularizations to ensure cleaner, more robust segmentation.

The CAR Module

The core of this work is the CAR module, a training-only component that refines the feature space. Unlike previous methods, CAR calculates "class centers" directly from the ground truth (GT), avoiding the "blind leading the blind" problem of noisy predictions.

Class-Aware Loss Functions

To optimize the feature space, the authors propose three novel loss functions:

  • Intra-class Center-to-Pixel (intra-c2p): This loss pulls pixel features toward their respective class centers, ensuring that the representation of a single category is compact.
  • Inter-class Center-to-Center (inter-c2c): This pushes different class centers away from each other, preventing the model from confusing similar categories (e.g., "sidewalk" vs. "road").
  • Inter-class Center-to-Pixel (inter-c2p): This further pushes individual pixels away from the centers of other classes, providing robustness against misclassification in complex scenes.
Figure 6: Technical implementation of the CAR module. (A) Integration into ResNet and Swin architectures. (B) Internal structure of the CAR module. (C-E) Mathematical flow for the three proposed loss functions.

Because these are regularization terms applied only to the loss function, the CAR module is discarded after training. The resulting model is smarter but maintains the same inference speed and memory footprint as the baseline.

Experimental Results

The authors evaluated CAR on major benchmarks including Pascal Context, COCO-Stuff-10K, and Cityscapes.

  • Significant Accuracy Boost: On Pascal Context, adding CAR to a ResNet-50 baseline improved the mean Intersection over Union (mIOU) from 48.32% to 50.50% (+2.18%).
  • Superior Generalization: On the challenging COCO-Stuff-10K dataset (171 classes), CAR provided a boost of up to 2.23% mIOU.
  • Architecture Agnostic: The module proved effective on both traditional CNNs (ResNet) and modern Transformers (Swin-Tiny).

Visual analysis via similarity heatmaps confirms that with CAR, a pixel's "energy" is tightly concentrated on its own object, whereas baseline models often show high similarity "leaking" into unrelated background classes like grass or sky.

Conclusion

CAR offers a simple yet powerful strategy for improving semantic segmentation by focusing on the structure of the feature space. By maximizing inter-class distance and minimizing intra-class variance during training, the network learns the "essence" of objects rather than just their typical surroundings. While the module requires careful hyperparameter tuning for the margin thresholds in high-class-count datasets, its ability to provide significant performance gains with zero inference overhead makes it a valuable tool for modern computer vision pipelines.

Summary updated

BibTeX
@inproceedings{huang2022car,
  author = {Ye Huang and Di Kang and Liang Chen and Xuefei Zhe and Wenjing Jia and Linchao Bao and Xiangjian He},
  title = {{CAR: Class-Aware Regularizations for Semantic Segmentation}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-19815-1\_30},
}
Figure