Knowledge Distillation from Single to Multi Labels: an Empirical Study

Youcai Zhang, Yuzhuo Qin, Hengwei Liu, Yanhao Zhang, Yaqian Li, Xiaodong GuarXiv 2023

Abstract

Knowledge distillation (KD) has been extensively studied in single-label image classification. However, its efficacy for multi-label classification remains relatively unexplored. In this study, we firstly investigate the effectiveness of classical KD techniques, including logit-based and feature-based methods, for multi-label classification. Our findings indicate that the logit-based method is not well-suited for multi-label classification, as the teacher fails to provide inter-category similarity information or regularization effect on student model's training. Moreover, we observe that feature-based methods struggle to convey compact information of multiple labels simultaneously. Given these limitations, we propose that a suitable dark knowledge should incorporate class-wise information and be highly correlated with the final classification results. To address these issues, we introduce a novel distillation method based on Class Activation Maps (CAMs), which is both effective and straightforward to implement. Across a wide range of settings, CAMs-based distillation consistently outperforms other methods.

Introduction

While Knowledge Distillation (KD) is a cornerstone of single-label classification, it often fails in the more complex multi-label setting. In single-label tasks, models predict one mutually exclusive category using a Softmax function. However, multi-label classification (MLC) typically employs a Sigmoid function, treating each category as an independent binary classification task.

Classical KD techniques struggle in MLC for two primary reasons:

  1. Logit-based KD: Transferring "soft targets" is less effective because independent Sigmoid outputs do not capture the inter-class similarities (the "dark knowledge") that drive KD's success in single-label tasks.
  2. Feature-based KD: Transferring intermediate layers often results in "information smearing," where features of multiple distinct objects are bundled together, making it difficult for the student to distinguish between them.

Methodology

To bridge this gap, we introduce CAM-based Distillation. This approach utilizes Class Activation Maps (CAMs) to provide class-specific spatial signals to the student model.

Overview of the multi-label classification pipeline and the proposed CAM-based distillation.

The core components of this method include:

  • Class Activation Maps (CAMs): Unlike global attention maps, CAMs highlight specific regions contributing to the prediction of a specific class.
  • Decoupling Knowledge: CAMs naturally decouple the knowledge of different labels. The student learns "where" each object (e.g., a dog vs. a bicycle) is located as separate spatial signals.
  • Teacher-Probability Weighting: Distillation loss is weighted by the teacher's predicted probability for each class. This forces the student to focus on spatial patterns the teacher is highly confident about, acting as an intelligent sample re-weighting mechanism.

Experimental Setup

The proposed method was validated across several major computer vision benchmarks, including MS-COCO, PASCAL VOC 2007, and the massive-scale Open Images dataset. To test robustness against sparse data, we also created "Missing-Label COCO" variants where 25%, 60%, or even 99% of positive labels were removed.

Discussion and Results

The CAM-based method consistently outperformed both student baselines and classical KD methods. On MS-COCO, it improved a ResNet18 student from 74.09% to 79.00% mAP, significantly better than traditional Soft Target KD (74.93%).

Comparison of Attention Maps and decoupled CAMs across different label densities.

Key insights from our experiments include:

  • The "Pseudo-Label" Effect: Logit-based KD helps in MLC primarily by providing pseudo-labels. In datasets with missing annotations, the teacher model "fills in the blanks," allowing the student to learn from more complete data.
  • Spatial Decoupling: Standard attention maps often focus only on the most prominent object. CAMs allow the model to attend to multiple objects simultaneously in their respective spatial locations, which is vital for multi-label success.
  • Versatility: The method works across heterogeneous architectures, such as distilling knowledge from a Transformer teacher (Swin) to a CNN student (ResNet).

Conclusion and Future Work

Our study demonstrates that CAM-based distillation is a powerful tool for multi-label classification, particularly in scenarios with missing labels. However, challenges remain regarding computational scaling as the number of categories increases. Future work will explore more efficient implementations for massive datasets and investigate methods to better align heterogeneous feature spaces between different model architectures.

Summary updated

BibTeX
@misc{zhang2023knowledge,
  author = {Youcai Zhang and Yuzhuo Qin and Hengwei Liu and Yanhao Zhang and Yaqian Li and Xiaodong Gu},
  title = {{Knowledge Distillation from Single to Multi Labels: an Empirical Study}},
  year = {2023},
  eprint = {2303.08360},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.08360},
}
Figure