Abstract
Detection transformers have recently shown promising object detection results and attracted increasing attention. However, how to develop effective domain adaptation techniques to improve its cross-domain performance remains unexplored and unclear. In this paper, we delve into this topic and empirically find that direct feature distribution alignment on the CNN backbone only brings limited improvements, as it does not guarantee domain-invariant sequence features in the transformer for prediction. To address this issue, we propose a novel Sequence Feature Alignment (SFA) method that is specially designed for the adaptation of detection transformers. Technically, SFA consists of a domain query-based feature alignment (DQFA) module and a token-wise feature alignment (TDA) module. In DQFA, a novel domain query is used to aggregate and align global context from the token sequence of both domains. DQFA reduces the domain discrepancy in global feature representations and object relations when deploying in the transformer encoder and decoder, respectively. Meanwhile, TDA aligns token features in the sequence from both domains, which reduces the domain gaps in local and instance-level feature representations in the transformer encoder and decoder, respectively. Besides, a novel bipartite matching consistency loss is proposed to enhance the feature discriminability for robust object detection. Experiments on three challenging benchmarks show that SFA outperforms state-of-the-art domain adaptive object detection methods.
Introduction
While Detection Transformers (DETRs) have revolutionized object detection, they struggle when the "domain" changes—like moving from clear weather to thick fog. Most existing Unsupervised Domain Adaptive Object Detection (DAOD) methods were built for CNN-based detectors like Faster R-CNN, typically focusing on aligning the feature distributions produced by the CNN backbone.
However, this research identifies a critical "hidden" problem: even if you perfectly align the CNN backbone features, the subsequent Transformer layers (the encoder and decoder) still develop domain-specific biases. As the data flows deeper into the Transformer, the "domain gap" actually widens. This means a model trained on sunny city streets might see the features correctly at the backbone level but get confused by the sequence relationships when trying to detect cars in a foggy environment or a synthetic video game world.
Sequence Feature Alignment (SFA)
To address this deepening gap, the authors propose Sequence Feature Alignment (SFA), a framework that moves beyond simple backbone alignment to directly synchronize the complex sequence features inside the Transformer itself. SFA consists of three main pillars:
- Domain Query-based Feature Alignment (DQFA): A special "domain query" token is introduced into the Transformer. In the encoder, this token aggregates global scene context (like overall lighting or weather). In the decoder, it models object relationships. By forcing these domain queries to be indistinguishable between the source and target domains using a discriminator, the model learns a global, domain-invariant representation.
- Token-wise Feature Alignment (TDA): While DQFA handles the "big picture," TDA focuses on the details. It applies adversarial alignment to every individual token in the sequence. In the encoder, this helps with local textures; in the decoder, it ensures that individual object instances are represented consistently across domains.
- Bipartite Matching Consistency (BMC) Loss: Since target domain data has no labels, the model can easily become "indecisive." BMC forces different layers of the Transformer decoder to produce consistent predictions for the same image. This acts as a form of self-supervision that sharpens the model’s discriminative power on unlabeled data.
Experimental Evaluation
The researchers evaluated SFA on three distinct and challenging domain-shift scenarios: Weather Adaptation (Cityscapes to Foggy Cityscapes), Synthetic-to-Real Adaptation (Sim10k to Cityscapes), and Scene Adaptation (Cityscapes to BDD100k).
Key Results
SFA significantly outperformed both the "source-only" baselines and previous state-of-the-art CNN-based domain adaptation methods:
- Foggy Cityscapes: SFA achieved 41.3 mAP, a massive jump from the 28.5 mAP of the standard Deformable DETR. It also beat the best CNN-based method (GPA) which sat at 39.5 mAP.
- Sim10k to Cityscapes: SFA reached 52.6 car AP, outperforming the baseline (47.4) and previous SOTA methods (47.6).
- Consistency Matters: Ablation studies showed that the Bipartite Matching Consistency (BMC) loss alone provided a ~1.0 mAP boost, proving that internal model consistency is a powerful tool for unsupervised learning.
Conclusion
The most striking insight of this work is that Transformer layers are not passive observers; they actively transform features in a way that can re-introduce domain divergence even if the input backbone features are aligned. SFA shows that you need the synergy of global context (DQFA) and local instance details (TDA) to truly close the domain gap. By aligning scene layouts in the encoder and object-to-object relationships in the decoder, SFA provides a robust framework for deploying detection transformers in real-world, variable environments.
Summary updated