Scaling Semantic Segmentation Beyond 1K Classes on a Single GPU

Shipra Jain, Danda Pani Paudel, Martin Danelljan, Luc Van Gool

Introduction

Semantic segmentation—the task of assigning a label to every pixel in an image—has traditionally struggled to scale compared to image classification or object detection. While those tasks have expanded to over 10,000 classes, semantic segmentation typically remains limited to around 150 categories (e.g., the ADE20k dataset).

The primary obstacle is a "memory wall": standard architectures produce output tensors of size $Height \times Width \times Classes$. For high-resolution images and thousands of classes, the memory required for this final layer can easily exceed the capacity of a single high-end GPU, forcing researchers to use tiny batch sizes or expensive multi-GPU setups. This paper introduces a novel training methodology that decouples memory usage from class count, enabling large-scale segmentation on consumer-grade hardware.

Methods

The authors propose an embedding-based scalable segmentation approach. Instead of the network predicting $C$ channels (one for each class), it predicts a fixed, low-dimensional embedding $d$ (where $d \ll C$, e.g., $d=12$). This shift reduces the model's space complexity from $O(C)$ to $O(1)$ relative to the number of classes.

Proposed architecture for scalable semantic segmentation using pixel embeddings and kNN-based loss.

Key components of this architecture include:

  • Class Embeddings: The model learns a separate set of $d$-dimensional vectors representing each class.
  • Approximate Cross-Entropy: To calculate loss without reconstructing a massive probability map, the authors use a $k$-nearest neighbor (kNN) search to find the $k$ "hardest" negative classes for a pixel and compute a localized cross-entropy loss.
  • Max-Margin Regularization: To prevent class embeddings from collapsing into each other, a repulsive force is applied to ensure different categories remain distinct in the embedding space.

Datasets

The researchers evaluated their method on several standard benchmarks and a new massive "Frankenstein" dataset:

  • Cityscapes, Pascal VOC, ADE20k, and COCO-Stuff10k: Ranging from 19 to 182 classes.
  • COCO+LVIS: A new benchmark created by merging COCO and LVIS annotations to create a challenging dataset with 1,284 classes.

Key Results and Insights

The proposed method demonstrates significant advantages in both efficiency and performance as the number of classes grows. On the COCO+LVIS (1,284 classes) dataset, the method achieved a mean Intersection over Union (mIoU) of 4.57, compared to just 1.68 for the DeepLabV3+ baseline—a 2.7x improvement.

Comparison of validation mIoU between the baseline and the proposed method as the class count scales to 1,284.

Several insights emerged from the experiments:

  • Decoupling is Key: By moving the class-heavy computation into a kNN-based lookup, the neural network architecture remains lightweight regardless of the label space size.
  • Semantic Proximity: Because the model learns embeddings, rare classes can "borrow" knowledge from similar, more common classes because they are forced to live in the same low-dimensional semantic space.
  • Batch Size Efficiency: On the 1,284-class dataset, the baseline model could only fit a batch size of 2 on a single GPU. The proposed method fit a batch size of 10, leading to much more stable training and better convergence.

Conclusion

The primary trade-off for this memory efficiency is computational time, as performing kNN searches for every pixel adds overhead. However, the ability to successfully train on 1,284 classes using a single Titan X GPU represents a significant step forward for long-tail semantic segmentation. Future work may involve optimizing kNN search using non-exhaustive methods or improving classification accuracy at object boundaries.

Summary updated

BibTeX
@misc{jain2020scaling,
  author = {Shipra Jain and Danda Pani Paudel and Martin Danelljan and Luc Van Gool},
  title = {{Scaling Semantic Segmentation Beyond 1K Classes on a Single GPU}},
  year = {2020},
  eprint = {2012.07489},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2012.07489},
}
Figure