Video Class Agnostic Segmentation with Contrastive Learning for Autonomous Driving

Mennatullah Siam, Alex Kendall, Martin JagersandarXiv 2021

TL;DR

This paper tackles the "unknown object" problem in autonomous driving by moving beyond standard closed-set semantic segmentation to video class agnostic segmentation. By introducing a novel auxiliary contrastive loss guided by both pixel-wise semantics and temporal consistency, the authors enable models to better identify and segment rare or unseen objects, significantly improving safety-critical perception.

What Problem Does This Paper Address?

Most semantic segmentation models for self-driving cars operate on a "closed-set" assumption: they are trained to recognize a fixed list of classes (e.g., car, road, pedestrian). However, the real world is messy. A car might encounter a shopping cart, a fallen tree, or a specific type of construction barrier not present in its training data.

Standard models often fail catastrophically here, either ignoring these objects or misclassifying them as known categories. This paper addresses the need for class-agnostic segmentation, where the system can identify "unknown" objects as distinct entities, even if it doesn't have a specific label for them. The authors specifically focus on video sequences, leveraging the fact that objects should remain consistent over time.

Methods

The authors propose a two-stream backbone (processing both appearance and depth) and introduce a novel auxiliary contrastive loss to improve the discrimination between known and unknown regions. Their approach features two main types of guidance:

  1. Semantic Guidance (Prototype CL): Instead of contrasting entire images, the model contrasts "prototypes"—feature representations of specific regions. It uses semantic masks to group pixels of the same class, encouraging the model to push features of different classes (like "Car" vs. "Bus") further apart in the embedding space.
  2. Temporal Guidance (Temporal CL): This unsupervised variant ensures that an object's representation remains stable across video frames. By using optical flow to warp features from one frame to the next, the model learns that the "positive" match for a region in frame $t$ is its corresponding aligned region in frame $t-1$, while all other regions are "negatives."
Figure 4: Our method for Video Class Agnostic Segmentation using Contrastive Learning. Input: appearance and depth. Prototype CL: semantic segmentation guides the region extraction, where positives are sampled from same class as the anchor, while negatives are from different classes. Temporal CL: aligns representation from It−1 to It using Optical flow, then positive region is sampled as the aligned region to the anchor, while negatives are other regions in order to ensure temporal consistency of the embeddings.

To handle the "unknown" class during inference, the model learns a global trainable constant ($\gamma$). If a pixel's features are too far from all known class signatures, it is classified as an unknown object.

Datasets

The researchers evaluated their approach on two primary benchmarks:

  • Cityscapes-VPS: A video version of the popular Cityscapes dataset. To simulate the "unknown" problem, they withheld four classes (Person, Rider, Motorcycle, and Bicycle) during training and used them as the test-set unknowns.
  • CARLA Synthetic Dataset: Because real-world data for rare objects is scarce, the authors released a new large-scale synthetic dataset (50k training images) generated in the CARLA simulator. It includes specific high-risk scenarios like construction sites and parking lots filled with rare objects like garbage bins and traffic cones.
Figure 2: Our different scenarios in the Carla Simulation environment [6] and objects considered as unknown in our synthetic data.

Key Insights and Ideas

  • Beyond Image-Level Contrast: Most contrastive learning happens at the image level (e.g., SimCLR). The authors argue that for dense tasks like segmentation, we must contrast regions or prototypes to capture the fine-grained boundaries needed to separate a "known" car from an "unknown" obstacle.
  • Visual Similarity vs. Semantic Distance: By using agglomerative clustering to create a dendrogram of unknown objects, the authors show that objects visually similar in texture (like street barriers and traffic cones) are semantically closer in the feature space. This helps explain why the model can generalize to new objects that share visual traits with those seen during training.
Figure 3: Dendrogram among unknown objects across training and testing data, showing their similarity computed in feature space.
  • Implicit Hard Negative Mining: The contrastive loss naturally performs "hard negative mining," forcing the model to work harder to distinguish between classes that are easily confused, such as traffic signs and traffic lights.

Key Results

The auxiliary contrastive loss provided consistent improvements across the board:

  • Cityscapes-VPS: The Prototype CL variant improved the Class Agnostic IoU (CA-IoU)—the metric for unknown objects—from 17.9% to 21.5% compared to the baseline.
  • Temporal Consistency: Temporal guidance also outperformed the baseline (reaching 21.4% CA-IoU), proving that motion cues are a powerful unsupervised signal for identifying distinct objects.
  • Small-Scale Effectiveness: The authors found that contrastive learning is particularly effective when training data is limited or when there is low variability in the objects labeled as "unknown" during training.

Limitations and Future Work

  • Scaling to Abundant Data: Interestingly, the baseline performed very well on the full-scale CARLA dataset (which is 25x larger than Cityscapes-VPS), and the relative gain from contrastive learning was smaller. The authors note that how contrastive loss scales with massive, diverse datasets remains an open question.
  • Reliance on a Global Constant: The current method relies on a learnable constant $\gamma$ to threshold "unknowns." Future work could explore more dynamic ways to define the boundaries of the "known" world without relying on this fixed parameter.
  • Computational Constraints: Due to GPU memory limits, the authors had to use a memory queue for prototypes rather than a momentum encoder, which might limit the number of negative samples the model can see at once.

Summary updated

BibTeX
@misc{siam2021video,
  author = {Mennatullah Siam and Alex Kendall and Martin Jagersand},
  title = {{Video Class Agnostic Segmentation with Contrastive Learning for Autonomous Driving}},
  year = {2021},
  eprint = {2105.03533},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.03533},
}
Figure