Gradient-Guided Knowledge Distillation for Object Detectors

Qizhen Lan, Qing Tian

Abstract: Deep learning models have demonstrated remarkable success in object detection, yet their complexity and computational intensity pose a barrier to deploying them in real-world applications (e.g., self-driving perception). Knowledge Distillation (KD) is an effective way to derive efficient models. However, only a small number of KD methods tackle object detection. Also, most of them focus on mimicking the plain features of the teacher model but rarely consider how the features contribute to the final detection. In this paper, we propose a novel approach for knowledge distillation in object detection, named Gradient-guided Knowledge Distillation (GKD). Our GKD uses gradient information to identify and assign more weights to features that significantly impact the detection loss, allowing the student to learn the most relevant features from the teacher. Furthermore, we present bounding-box-aware multi-grained feature imitation (BMFI) to further improve the KD performance. Experiments on the KITTI and COCO-Traffic datasets demonstrate our method’s efficacy in knowledge distillation for object detection. On one-stage and two-stage detectors, our GKD-BMFI leads to an average of 5.1% and 3.8% mAP improvement, respectively, beating various state-of-the-art KD methods.

Introduction

Object detection is a cornerstone of modern computer vision, particularly in safety-critical domains like autonomous driving. However, the high-performance models required for these tasks are often too large and computationally demanding for real-time deployment on edge devices. Knowledge Distillation (KD) provides a solution by training a compact "student" model to replicate the behavior of a larger "teacher" model.

Despite its potential, applying KD to object detection is challenging. Most existing methods treat all teacher features as equally important or rely on simple heuristics, such as focusing only on areas within bounding boxes. This approach often fails because not all features contribute equally to the final detection; some may even introduce noise. This paper introduces Gradient-Guided Knowledge Distillation (GKD) to address these limitations by making the distillation process task-aware.

Gradient-Guided Knowledge Distillation (GKD)

The primary innovation of GKD is the use of task-specific gradients to identify "important" features. Instead of merely mimicking feature activations, GKD examines the gradients of the detection loss with respect to those features. Since gradients indicate how much a specific feature influences the final output, they serve as an ideal importance weight. Features with larger gradients are prioritized, forcing the student to focus on the most influential "dark knowledge" provided by the teacher.

Overview of the Gradient-Guided Knowledge Distillation (GKD) framework, illustrating how gradients from the detection loss guide the feature imitation process.

This mechanism is computationally efficient because it utilizes gradient information already calculated during the standard backpropagation process. By weighting the distillation loss with these gradients, the student model learns to prioritize features that are critical for accurate detection while ignoring irrelevant background information.

Bounding-box-aware Multi-grained Feature Imitation (BMFI)

To complement GKD, the authors propose Bounding-box-aware Multi-grained Feature Imitation (BMFI). This component refines the spatial focus of the student model using a novel FlatGauss Mask (FGM).

Previous spatial attention methods often suffered from a trade-off: cropping strictly to the bounding box loses contextual information, while standard Gaussian masks may not sufficiently emphasize the object itself. The FlatGauss Mask resolves this by assigning a constant weight of 1 to all pixels within the ground-truth bounding box, followed by an exponential decay for the surrounding area. This ensures the student captures vital context near the object without being overwhelmed by distant background noise.

Comparison of spatial attention masks: (a) GT Box, (b) FGFI, (c) Gaussian Box, and (d) the proposed FlatGauss Mask.

Experimental Results

The effectiveness of GKD-BMFI was validated on the KITTI and COCO-Traffic datasets across various detector architectures:

  • Performance Gains: The method achieved an average mAP improvement of 5.1% for one-stage detectors (GFL) and 3.8% for two-stage detectors (Faster R-CNN). On the KITTI dataset, a ResNet-18 student distilled with GKD-BMFI showed a 6.8% mAP increase over its baseline.
  • Architectural Robustness: GKD-BMFI proved effective even across different architectures. For instance, distilling knowledge from a Swin Transformer teacher into a ResNet-18 student resulted in a competitive 68.2 mAP.
  • Efficiency: The distilled student models (ResNet-50/18) achieved these performance boosts while reducing parameters by 34% to 67% and FLOPs by 20% to 33% compared to the ResNet-101 teacher.

Conclusion

Gradient-Guided Knowledge Distillation (GKD) and Bounding-box-aware Multi-grained Feature Imitation (BMFI) provide a robust framework for creating efficient object detectors. By leveraging gradient information and optimized spatial masks, GKD-BMFI ensures that student models learn the most relevant features for the task at hand, significantly outperforming previous state-of-the-art distillation techniques.

Summary updated

BibTeX
@inproceedings{lan2024gradient,
  author = {Qizhen Lan and Qing Tian},
  title = {{Gradient-Guided Knowledge Distillation for Object Detectors}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  url = {https://openreview.net/forum?id=zbDI5LqaBF},
}
Figure