Optimizing YOLOv5s Object Detection through Knowledge Distillation algorithm

Guanming Huang, Aoran Shen, Yuxiang Hu, Junliang Du, Jiacheng Hu, Yingbin Liang · DOI

Abstract

This study explores enhancing the performance of the lightweight YOLOv5s object detection model using Knowledge Distillation (KD) from a larger YOLOv5l teacher. By implementing decoupled detection heads and probabilistic bounding box representations, the researchers achieved a significant 6.7% improvement in mAP50-95, bridging the gap between efficiency and high-precision localization.

Introduction

Real-time object detection on edge devices requires a delicate balance between computational efficiency and detection accuracy. While large models like YOLOv5l offer superior precision, their heavy resource requirements limit deployment. Conversely, smaller models like YOLOv5s are fast but often struggle with "location blur"—imprecise boundary definition in complex scenes. This paper addresses this gap through a specialized Knowledge Distillation framework.

Methodology

The proposed approach utilizes a teacher-student paradigm where YOLOv5l guides the training of YOLOv5s. Key innovations include:

Decoupled Detection Heads

Traditional YOLO architectures often share feature maps for classification and localization. This study separates these tasks into decoupled heads, allowing the student model to learn category-specific features and spatial coordinates independently, minimizing task interference.

Architecture of the optimized YOLOv5s model featuring decoupled detection heads for classification and localization.

Probabilistic Bounding Boxes

Rather than treating bounding box coordinates as fixed Dirac-delta distributions, the authors model them as probability distributions. This allows the teacher to convey spatial uncertainty to the student, resulting in smoother and more accurate edge localization.

Selective Distillation and Temperature Tuning

The framework identifies Key Distillation Regions (KDR) to focus the student's attention on informative image areas. Furthermore, a "temperature" hyperparameter ($T$) is used to soften the teacher's output. Experiments indicated that higher temperatures (up to $T=45$) provide a richer gradient, facilitating better knowledge transfer.

Experimental Setup

The models were evaluated using a 6,000-image subset of the MS COCO dataset, split 8:1:1 for training, validation, and testing. This subset provides a diverse range of 80 object categories for robust performance assessment.

Results and Discussion

The distillation process yielded substantial improvements over the baseline YOLOv5s model.

Model Distillation Temp ($T$) mAP50 mAP50-95
YOLOv5s (Baseline) - 91.33% 67.86%
Ours-5 (Best) 45 96.75% 74.56%

The distilled model achieved a 5.42% increase in mAP50 and a 6.7% increase in mAP50-95. Analysis of the training process shows efficient convergence.

Training loss curve showing model convergence over 200 epochs.

As shown in the loss curve, the model stabilizes significantly after approximately 150 epochs, validating the efficiency of the distillation strategy. The marked improvement in the high-threshold mAP50-95 metric confirms that the student model has successfully internalized the teacher's precise localization capabilities.

Conclusion

By combining decoupled heads, probabilistic modeling, and careful temperature tuning, this research demonstrates that lightweight models can achieve near-state-of-the-art performance. Future work will focus on scaling these techniques to the full COCO dataset and evaluating real-world inference latency on specialized edge hardware.

Summary updated

BibTeX
@misc{huang2024optimizing,
  author = {Guanming Huang and Aoran Shen and Yuxiang Hu and Junliang Du and Jiacheng Hu and Yingbin Liang},
  title = {{Optimizing YOLOv5s Object Detection through Knowledge Distillation algorithm}},
  year = {2024},
  eprint = {2410.12259},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.12259},
}
Figure