Contrastive Learning for Multi-Object Tracking with Transformers

Pierre-François De Plaen, Nicola Marinello, Marc Proesmans, Tinne Tuytelaars, Luc Van Gool

Abstract

Multi-Object Tracking (MOT) requires robust object detection and precise temporal association. While the DEtection TRansformer (DETR) has redefined object detection, its standard embeddings lack the discriminative power for long-term re-identification. We present ContrasTR (Contrastive TRansformer), a streamlined approach that adapts DETR for MOT by incorporating an instance-level contrastive loss and a video-aware sampling strategy. By learning identity-aware spatial embeddings, ContrasTR achieves state-of-the-art performance on the BDD100K dataset (+2.6 mMOTA) without the need for complex temporal modules or specialized track queries.

Introduction

The task of Multi-Object Tracking (MOT) involves two primary challenges: detecting objects within individual frames and associating these detections across a temporal sequence (re-identification). The DEtection TRansformer (DETR) architecture revolutionized detection by treating it as a set prediction task. However, its internal representations are optimized for spatial localization and category classification rather than temporal consistency. Standard DETR embeddings are often insufficient to distinguish between different instances of the same class over time.

Previous research has attempted to bridge this gap by introducing heavy temporal aggregation networks or specialized "track queries." While effective, these additions significantly increase architectural complexity and computational overhead. ContrasTR addresses this by asking whether a standard DETR can become a high-performance tracker simply by improving the discriminative quality of its features through contrastive learning.

Methods

ContrasTR maintains the core DETR architecture while introducing a lightweight framework for learning tracking-specific features.

Tracking Projection Head

A small Feed-Forward Network (FFN) is added as a branch from the transformer decoder. This head maps high-dimensional object features into a dedicated "tracking embedding" space, separate from the detection and classification spaces.

Instance-Level Contrastive Loss

The model is trained using a supervised contrastive loss. This objective functions as a mathematical "tug-of-war," pulling embeddings of the same object instance from different frames closer together while pushing embeddings of distinct objects further apart. This process ensures that the resulting feature space is highly identity-aware.

t-SNE visualization of the learned tracking embeddings, showing how different views of the same vehicle instance cluster together.

Video-Aware Sampling and Association

To facilitate contrastive learning, the authors implemented a video-aware sampling strategy. Unlike standard detection training that uses random images, this strategy samples multiple frames from the same video within a single batch, providing the necessary "positive pairs" for the contrastive loss.

At inference time, association is handled via a simple memory queue. New detections are matched to existing tracks using the Hungarian algorithm, based on the cosine similarity of their tracking embeddings. This avoids the need for complex motion models or heuristic-heavy post-processing.

Results

The performance of ContrasTR was evaluated on the BDD100K and MOT17 benchmarks.

  • BDD100K: ContrasTR achieved a state-of-the-art 42.8 mMOTA, outperforming the previous leading method (SUSHI) by 2.6 points. It demonstrated significant robustness in diverse driving conditions, including nighttime and inclement weather.
  • MOT17: The model reached 73.7 MOTA, remaining competitive with more complex transformer-based trackers like TrackFormer and MOTR.
  • Ablation Studies: The importance of the contrastive loss was confirmed through ablation; removing it resulted in a performance drop from 35.1 to 32.9 mMOTA on BDD100K, highlighting that learned embeddings are the primary driver of the system's success.

Discussion and Conclusion

ContrasTR demonstrates that simplicity can be highly effective in MOT. By focusing on the quality of spatial embeddings rather than architectural complexity, the model achieves superior results on challenging datasets like BDD100K. A key innovation is the "pseudo-track" trick, where the model is pre-trained on static image datasets (like COCO) by treating augmented versions of the same image as different frames. This allows the tracking head to leverage vast amounts of detection data.

While ContrasTR excels in appearance-based re-identification, it currently lacks the explicit motion modeling (e.g., Kalman filters) used by some top-performing CNN-based trackers on benchmarks like MOT17. Future work may explore integrating lightweight motion cues or enhancing robustness to extreme lighting variations where appearance features are less reliable.

Summary updated

BibTeX
@inproceedings{plaen2024contrastive,
  author = {Pierre-François De Plaen and Nicola Marinello and Marc Proesmans and Tinne Tuytelaars and Luc Van Gool},
  title = {{Contrastive Learning for Multi-Object Tracking with Transformers}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00672},
}
Figure