TL;DR
This paper introduces CLOCKDistill, a novel knowledge distillation method for DETR (Detection Transformer) models. It addresses the challenges of distilling both the rich global context from DETR's transformer encoder and the unstable logit predictions by proposing a location- and context-aware memory distillation strategy and target-aware queries derived from ground truth.
What Problem Does This Paper Address?
DETR models have achieved state-of-the-art performance in object detection by treating it as a set prediction problem, eliminating the need for hand-crafted components like anchor boxes and NMS. However, DETRs are computationally expensive, making them difficult to deploy in resource-constrained environments. Knowledge distillation (KD) is a common technique to compress models, but applying it effectively to DETRs has been challenging. Existing KD methods for DETRs often fail to capture the transformer's unique global context and struggle with unstable logit distillation due to the unordered nature of DETR's queries. Furthermore, previous approaches to guide distillation often rely on noisy or unreliable heuristics, rather than precise ground truth information.
Methods
CLOCKDistill tackles these challenges with two main components:
- Location-and-Context-aware Memory Distillation: Instead of distilling backbone features, CLOCKDistill distills the transformer encoder's output (the "memory"). This memory is rich in global context. To make this distillation more effective, they introduce:
- Location-aware Mask (M): This mask uses ground truth bounding box coordinates to highlight relevant regions within the encoder memory, guiding the student to focus on object areas.
- Scale Mask (S): This mask helps balance the influence of objects of different sizes and the background, preventing larger objects or abundant background from dominating the distillation process.
- Target-aware Consistent Logit Distillation: To overcome the instability in distilling DETR's logit predictions, CLOCKDistill proposes generating "target-aware queries" directly from ground truth bounding box class labels and spatial parameters. These unlearnable queries are fed into both the teacher and student models, ensuring they attend to consistent and informative parts of the encoder memory for logit distillation.
Datasets
The paper evaluates CLOCKDistill on two standard object detection datasets:
- KITTI: A benchmark for autonomous driving, often used for scenarios requiring low latency and constrained resources.
- MS COCO: A large-scale dataset with 80 object categories, commonly used for general object detection tasks.
Key Insights and Ideas
- DETR Memory is Richer than Backbone Features: The paper demonstrates that distilling the transformer encoder's memory, which captures global context, yields better performance than distilling traditional CNN backbone features. This highlights the unique representational power of the transformer's self-attention mechanism.
- Spatial Cues are Crucial for DETR Distillation: Contrary to the notion that transformers lose spatial structure, the authors show that DETR's encoder memory retains meaningful spatial coherence. Leveraging ground truth to create location-aware masks significantly improves distillation.
- Ground Truth is the Best Guide for Logit Distillation: The proposed target-aware queries, derived directly from ground truth, provide a stable and consistent signal for logit distillation, outperforming methods relying on heuristic or teacher-generated points.
- Balancing Object and Background Influence: The scale mask is a clever way to ensure that distillation is not overly biased by large objects or a dominant background, leading to more balanced learning.
Key Results
CLOCKDistill consistently improves the performance of various DETR detectors (DINO, DAB-DETR, Deformable-DETR, Align-DETR) on both KITTI and COCO datasets.
- Performance Gains: The method achieves significant improvements, ranging from 2.2% to 6.4% in mAP across different DETR models and datasets. For instance, it boosts DINO performance by up to 6.4% on KITTI and 2.9% on COCO.
- State-of-the-Art Comparison: CLOCKDistill outperforms existing knowledge distillation methods for DETRs, such as DETRDistill and KD-DETR, by a notable margin.
- Qualitative Improvements: Attention maps show that the distilled models allocate more focus to relevant objects and exhibit more clearly defined boundaries compared to baselines and other KD methods.
- Efficiency: The method also shows potential for efficiency gains, with a distilled model achieving a 1.6x increase in frames per second (FPS) when using fewer transformer layers, while still surpassing the full-scale baseline.
Limitations and Future Work
- Computational Cost: While the goal is compression, the distillation process itself still requires a teacher model, which is computationally expensive.
- Hyperparameter Tuning: The method involves several hyperparameters (e.g., $\alpha$, $\beta$, $\lambda_{KL}$, $\lambda_{L1}$, $\lambda_{GIoU}$) that need to be tuned for optimal performance.
- Future Work: The authors suggest that their method's ability to achieve sharper object focus and better boundary definition could be beneficial for future tasks like segmentation. The effectiveness of target-aware queries and location-aware memory distillation also opens avenues for further exploration in other transformer-based architectures.
Summary updated