Knowledge Distillation for Object Detection via Rank Mimicking and Prediction-Guided Feature Imitation

Gang Li, Xiang Li, Yujie Wang, Shanshan Zhang, Yichao Wu, Ding Liang

Abstract

Knowledge Distillation (KD) is a powerful technique for compressing large teacher models into efficient student models. However, its application to object detection is challenging due to the complex nature of the task, which involves both classification and localization. This paper presents KD-RP, a novel framework that addresses these challenges through two primary components: Rank Mimicking (RM) and Prediction-Guided Feature Imitation (PFI). RM focuses on preserving the relative ranking of candidate boxes, which is crucial for the Non-Maximum Suppression (NMS) process. PFI adaptively guides feature imitation by focusing on regions where the student and teacher predictions diverge, preventing the introduction of counterproductive gradients. Experimental results on MS COCO and PASCAL VOC demonstrate that KD-RP significantly outperforms existing state-of-the-art distillation methods, boosting a RetinaNet-ResNet50 model by 3.5% mAP on COCO.

Introduction

The goal of Knowledge Distillation (KD) is to transfer knowledge from a high-capacity "teacher" network to a more compact "student" network. While successful in image classification, KD for object detection faces unique hurdles. Standard classification KD focuses on matching category probabilities, but detection requires precise localization and the ability to rank thousands of potential bounding boxes.

The authors identify two fundamental limitations in current detection KD:

  1. Ranking Discrepancy: Detection models must rank candidate boxes so that NMS can select the most accurate one. Traditional KD matches individual box scores independently, ignoring the global relationship or "rank" between these boxes.
  2. Inefficient Feature Imitation: Most methods force the student to mimic the teacher's feature maps across the entire image. However, feature map differences do not always translate to prediction differences. Forcing imitation in regions where the student is already performing correctly can waste model capacity and introduce "unexpected gradients" that hinder training.

The KD-RP Framework

Rank Mimicking (RM)

To address the ranking discrepancy, the authors propose Rank Mimicking. Instead of treating each anchor point as an independent classification task, RM considers the set of all positive anchors assigned to an object. By applying a Softmax over the scores of these anchors, a probability distribution is created that represents their relative importance or rank.

Comparison of traditional local soft labels versus the proposed global rank distribution.

The student is trained to minimize the KL-divergence between its rank distribution and that of the teacher. This approach teaches the student to identify which parts of an object are most representative, ensuring that the highest-ranked boxes are consistent with the teacher's expertise.

Prediction-Guided Feature Imitation (PFI)

PFI optimizes feature imitation by making it adaptive and data-driven. Rather than using hand-crafted masks to define "important" regions, PFI calculates a spatial weight map based on the difference between the teacher's and student's predictions.

Visualization of how prediction differences guide feature imitation to avoid unexpected gradients and focus on areas of inconsistency.

In regions where the student's predictions significantly differ from the teacher's, the imitation loss is weighted more heavily. Conversely, in regions where the student already matches the teacher's output, the imitation pressure is relaxed. This ensures that the student's limited parameters are utilized to correct actual errors rather than redundantly copying feature patterns that do not affect the final output.

Experimental Results

The KD-RP framework was evaluated on the MS COCO and PASCAL VOC benchmarks across several popular detector architectures, including RetinaNet, FCOS, ATSS, and GFL.

  • Performance Gains: On MS COCO, KD-RP improved a RetinaNet-ResNet50 baseline from 36.9% to 40.4% mAP, a 3.5% absolute gain. This surpasses previous state-of-the-art methods like DeFeat (39.7% mAP).
  • Robustness: The method proved effective even when distilling across different backbone architectures (e.g., ResNet101 teacher to ResNet50 student).
  • Efficiency: By focusing on rank distributions and prediction-guided regions, KD-RP provides a more signal-dense training signal, leading to faster and more effective convergence for the student model.

Conclusion and Future Work

KD-RP shifts the focus of detection distillation from simple point-wise mimicking to structural rank preservation and adaptive feature imitation. While highly effective, the authors note that the method's performance on very small objects ($AP_S$) slightly lags behind methods that use explicit region-of-interest (RoI) normalization. Future work will explore ways to better handle scale variance in pixel-wise distillation to improve performance on tiny objects.

Summary updated

BibTeX
@inproceedings{li2022knowledge,
  author = {Gang Li and Xiang Li and Yujie Wang and Shanshan Zhang and Yichao Wu and Ding Liang},
  title = {{Knowledge Distillation for Object Detection via Rank Mimicking and Prediction-Guided Feature Imitation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i2.20018},
}
Figure